4D v16.3Day number |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
Day number
|
Day number ( aDate ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
aDate | Date |
![]() |
Date for which to return the number | |||||
Function result | Longint |
![]() |
Number representing the weekday on which date falls | |||||
The Day number command returns a number representing the weekday on which aDate falls.
Note: Day number returns 2 for null dates.
4D provides the following predefined constants, found in the "Days and Months" theme:
Constant | Type | Value |
Sunday | Longint | 1 |
Monday | Longint | 2 |
Tuesday | Longint | 3 |
Wednesday | Longint | 4 |
Thursday | Longint | 5 |
Friday | Longint | 6 |
Saturday | Longint | 7 |
Note: Day number returns a value between 1 and 7. To get the day number within the month for a date, use the command Day of.
The following example is a function that returns the current day as a string:
$viDay :=Day number(Current date) ` $viDay gets the current day number
Case of
:($viDay =1)
$0:="Sunday"
:($viDay =2)
$0:="Monday"
:($viDay =3)
$0:="Tuesday"
:($viDay =4)
$0:="Wednesday"
:($viDay =5)
$0:="Thursday"
:($viDay =6)
$0:="Friday"
:($viDay =7)
$0:="Saturday"
End case
Product: 4D
Theme: Date and Time
Number:
114
Created: < 4D v6
4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)