KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to get the day of the week from a date
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: August 31, 2001

If you want to find the day of the week for a given date, use the command Day number as shown below. Note that the values Sunday, Monday, etc. are constants in 4th Dimension that return the proper integer value for comparison.

$viDay:=Day number(Current date) ` $viDay gets the current day number

Case of

: ($viDay=Sunday )
$tDayName:="Sunday"

: ($viDay=Monday )
$tDayName:="Monday"

: ($viDay=Tuesday )
$tDayName:="Tuesday"

: ($viDay=Wednesday )
$tDayName:="Wednesday"

: ($viDay=Thursday )
$tDayName:="Thursday"

: ($viDay=Friday )
$tDayName:="Friday"

: ($viDay=Saturday )
$tDayName:="Saturday"

End case