WeekDay Function

Returns the number corresponding to the weekday represented by a serial date number that is generated by the DateSerial or the DateValue function.

Sintaksis:

WeekDay (Angka)

Nilai hasil:

Integer

Parameter:

Number: Integer expression that contains the serial date number that is used to calculate the day of the week (1-7).

The following example determines the day of the week using the WeekDay function when you enter a date.

Kode kesalahan:

5 Tidak sah dalam pemanggilan prosedur

Contoh:

Sub ExampleWeekDay

Dim sDay As String

' Return And display the day of the week

    Select Case WeekDay( Now )

        Case 1

            sDay="Minggu"

        Case 2

            sDay="Senin"

        Case 3

            sDay="Selasa"

        Case 4

            sDay="Rabu"

        Case 5

            sDay="Kamis"

        Case 6

            sDay="Jumat"

        Case 7

            sDay="Sabtu"

    End Select

    msgbox "" + sDay,64,"Hari ini adalah"

End Sub