| Date and time functions | Top Previous Next | 
| Date time values are stored as floating point values. The integer portion stores the number of days that have passed since 12/30/1899. The fractional part of the float value is fraction of a 24 hour day that has elapsed. 
 To display dates and times as strings, use the DateTimeToStr, DateToStr, TimeToStr and FormatDateTime functions. 
 function Now: Float; Returns the current date and time. 
 function Date: Float; Returns the current date. 
 function Time: Float; Returns the current time. 
 function UTCDateTime: Float; Returns the current UTC date and time. 
 function DateTimeToStr(DateTimeValue: Float): string; Returns the DateTimeValue as a string. 
 function DateToStr(DateValue: Float): string; Returns DateValue as a string. 
 function TimeToStr(TimeValue: Float): string; Returns TimeValue as a string. 
 function FormatDateTime(Format: string; DateTimeValue: Float): string; Formats DateTimeValue using Format. E.g. FormatDateTime('yyyy-mm-dd hh:nn:ss', Now) may return '2013-04-01 13:05:24'. See the Date-Time format strings topic on the supported formatting values. 
 function DayOfWeek(Date: Float): Integer; Returns the day of the week for a specified date. Returns a value between 1 and 7, where Sunday is the first day of the week and Saturday is the seventh. 
 function IsLeapYear(Year: Integer): Boolean; Indicates whether a specified year is a leap year. 
 function EncodeDate(Year, Month, Day: Integer): Float; Returns a float value that represents a specified Year, Month, and Day. E.g. EncodeDate(2013, 4, 1) returns the float value for April 1, 2013. 
 procedure DecodeDate(Date: Float; var Year, Month, Day: Integer); Returns Year, Month, and Day values for a float value. 
 function EncodeTime(Hour, Min, Sec, MSec: Integer): Float; Returns a float value for a specified Hour, Min, Sec, and MSec. E.g. EncodeTime(13, 10, 20, 0) returns the float value for the time 13:10:20.000. 
 procedure DecodeTime(Time: Float; var Hour, Min, Sec, MSec: Integer); Breaks a float value into hours, minutes, seconds, and milliseconds. 
 |