Day number

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 3


Day number (date) Number

ParameterTypeDescription
dateDateDate for which to return the number
Function resultNumberNumber representing the weekday on which
date falls

Description

The Day number command returns a number representing the weekday on which date falls.

Note: Day number returns 2 for null dates.

4th Dimension provides the following predefined constants:

ConstantsTypeValue
MondayLong Integer 2
TuesdayLong Integer 3
WednesdayLong Integer 4
ThursdayLong Integer 5
FridayLong Integer 6
SaturdayLong Integer 7
SundayLong Integer 1

Note: Day number of returns a value between 1 and 7. To get the day number within the month for a date, use the command Day of.

Example

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 

See Also

Day of.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next