Script Date/Time Functions
Script Date/Time Functions
The script language uses the following definition for date and time values: The integral part of a value is the number of days that have passed since 12/30/1899. The fractional part of a value is fraction of a 24 hour day that has elapsed.
Following are some examples of TDateTime values and their corresponding dates and times:
0 12/30/1899 12:00 am
2.75 1/1/1900 6:00 pm
-1.25 12/29/1899 6:00 am
35065 1/1/1996 12:00 am
To find the fractional number of days between two dates, simply subtract the two values, unless one of the TDateTime values is negative. Similarly, to increment a date and time value by a certain fractional number of days, add the fractional number to the date and time value.
More:
EncodeDate(Year, Month, Day: Word): DateTime
EncodeTime(Hour, Min, Sec, MSec: Word): DateTime
DecodeDate(Date: DateTime; var Year, Month, Day: integer)
DecodeTime(Time: DateTime; var Hour, Min, Sec, MSec: Word)
DayOfWeek(Date: TDateTime): Integer
DateToStr(Date: TDateTime): string