Gets the current date in string format.
Note: Time/Date functions can only be used with dates between 1980 and 2035. You should check that the date you are using is valid with Cicode similar to the following:
IF StrToDate(Arg1)>0 THEN
...
ELSE
... END
Syntax
Date( [Format] )
Format:
The format required:
Format of the string:
0 - Short time format, hh:mm AM/PM.
1 - Long time format, hh:mm:ss AM/PM.
2 - Short date format, dd/mm/yy.
3 - Long date format, day month year.
4 - Time and date, weekday month day year hh:mm:ss AM/PM.
5 - Long time period, hh:mm:ss. Time needs to be in seconds.
6 - Millisecond time period, hh:mm:ss.xxx ("xxx" represents milliseconds). Time needs to be in milliseconds.
7 - Short time period, hh:mm. Time needs to be in seconds.
8 - Long time period, "xxxxx Days hh Hours mm min ss sec where xxxxx = number of days since 1/1/1970". Time needs to be in seconds.
9 - Extended date format, dd/mm/yyyy.
10 - Local TimeDate format, yyyy-mm-dd hh:mm:ss
11 - Time of Day, hh:mm:ss tt format with no date
UTC:
Coordinated Universal Time (optional)
0 - Display the string as a local date/time (default).
1 - Display the string as a UTC date/time (valid for formats 0-4 and 9).
If omitted, the default Format is 2. These formats follow the Regional Settings found in the Windows Control Panel.
Return Value
The current date (in string format).
Related Functions
Example
/* If the current system date is 3rd November 1991 and the Windows date format is dd/mm/yy; */
str = Date();
! Sets str to "3/11/91".
str = Date(2);
! Sets str to "3/11/91".
str = Date(3);
! Sets str to "3rd November 1991".
See Also
Published June 2018