Date

(Engine-Level Function)

Description: Returns a text string giving the date that corresponds to the number of days since January 1, 1970.
Returns: Text
Usage: Script or steady state.
Function Groups: Time and Date
Related to: DateNum | Day | Month | Now | Time | Today | Year
Format: Date(Day, DateForm [, Flags, Locale])
Parameters:  
Day   
Required. Any numeric expression giving the number of days since January 1, 1970. This is a "Julian" style date. The function, Today() is commonly used.
DateForm

Required. Any numeric or text expression selecting the format for the date format. Will also accept a date locale such as "us-en", matching the Windows locale. If DateForm is numeric, the format for the date will be interpreted according to the standard Date Codes (predefined).
If DateForm is a text value, it is interpreted as a date formatting string. Please refer to the Date Formatting Strings in the appendix. Note that these key strings are case sensitive.

In the event that the DateForm parameter does not resolve to either a numeric or text value, the system-configured date format, as specified through the Windows Control Panel, is used. In this case, the Flags parameter is used to select from a number of options for the date.

Flags   

An optional parameter that is only used in the event that the DateForm parameter does not resolve to a numeric or a text value. The Flags parameter may be set as follows to adjust the format of the date.

Flags

Description

1

Generate the configured short form of the date (e.g. "29/03/04").

2

Generate the configured long form of the date (e.g. "29 March 2004").

8

Generate the configured year/month format (e.g. March 2004). Please note that this option is only available on Windows 2000/XP

Locale
Optional text. May be used to specify a locale for which to format the date. Use Windows-standard locale strings, such as "en-us".
Comments:

This function is primarily used to convert dates from historical data files to a format that is more easily readable. The Julian style date is used since it gives an easy method of calculating the time between dates and it is compact for historical records.

If Date is used with a predefined date code, then the result will always be in English, regardless of any system settings.

If Date is used with a format string, such as "dd MMMM yyyy", then the result will be in the user's locale. For example, "25 Febrero 2014"

Script Example:

  ZText(10, 590, Date(Today(), 4), 15, 0);

This displays today's date in the lower left of the screen.

Expression Example:

Date(Today(), 4)

This returns today's date as text in the form "Aug 13, 2012"