backIndex

Xelagot action script

Date and time variables and operations

All dates and times are in VRT (Virtual Reality Time, VRT = GMT - 2), unless otherwise stated or implemented by the script.

This page has the operations and the conditional statements involving date and time. For more time statements, see string statements, and 3.6 SQL statements.

The valid input ranges are:
Value for Range
year 1 to 9999, other values (including adjusted values) cause overflow and will be ignored
month 1 to 12, other signed values cause the year to be adjusted
day 1 to 28, 29, 30 or 31, according to the days in the month stored in the date-time variable, other signed values cause the month and year values to be adjusted
hour 0 to 23, other signed values cause adjustments in day, month, year
minute 0 to 59, other signed values cause adjustments in hour, day, month, year
second 0 to 59, other signed values cause adjustments in minute, hour, day, month, year

The DateTime variable is based on Delphi's TDateTime. Delphi's origin for date and time counting (internal value = 0) is 1899, December 30th 0h 0m 0s. Invalid dates and times will make the variable default to this date. Valid dates are between year 1, January 1st, and year 9999, December 31st.

The following operations apply to Date-time variables.

Variables shown in black may be substituted by literal values, variables shown in red are assigned the result of the operation, variables in green may not be substituted by their literal equivalents.

!a = !b assigns to !a the current date and time in !b. This is the direct assignment.
GetDateTime !a
GetLocalDateTime !a
assigns to !a the current date and time. (VRT or Local Time)
GetDateTime !a !b
assigns to !a all values stored in !b. This is a direct assignment, equivalent to !a = !b.
GetDateTime !a %y %mo %d %h %m %s assigns to !a the year, month, day, hour, minute, second stored in the numeric variables. This is equivalent to a direct assignment.
GetDateTime !a $b
the contents of variable $b are treated as 'part of the script', i.e. they may reference a time variable or integers.
See also String operations for GetDateTime $a and GetDateTime $a !b.
GetDate !a
GetLocalDate !a
assigns to !a the current date, does not alter the value of time. (VRT or Local Time, be careful not to mix them).
GetDate !a !b assigns to !a the date stored in !b. Does not alter the value of time.
GetDate !a %y %mo %d assigns to !a the year, month and day stored in %y %mo and %d (these can be literal values). Does not alter the value of time.
GetDate !a $b
the contents of variable $b are treated as 'part of the script', i.e. they may reference a time variable or integers.
See also String operations for GetDate $a and GetDate $a !b
GetTime !a
GetLocalTime !a
assigns to !a the current time, does not alter the value of date. (VRT or Local Time, be careful not to mix them).
GetTime !a !b assigns to !a the time stored in !b. Does not alter the value of date.
GetTime !a %h %m %s assigns to !a the hour, minutes and seconds stored in %h %m %s (these can be literal values). Does not alter the value of date.
GetTime !a $b
the contents of variable $b are treated as 'part of the script', i.e. they may reference a time variable or integers.
See also String operations for GetTime $a and GetTime $a !b
GetYear !a
GetLocalYear !a
assigns to !a the current year, does not alter other values. (VRT or Local Time, be careful not to mix them).
GetYear !a !b assigns to !a the year stored in !b. Does not alter other values.
GetYear !a %y assigns to !a the year stored in %y. Does not alter other values.
GetYear !a $b
the contents of variable $b are treated as 'part of the script', i.e. they may reference a time variable or integers.
See also Numeric operations for GetYear %a and GetYear %a !b and String operations for GetYear $a and GetYear $a !b
GetMonth !a
GetLocalMonth !a
assigns to !a the current month, does not alter other values. (VRT or Local Time, be careful not to mix them).
GetMonth !a !b assigns to !a the month stored in !b. Does not alter other values.
GetMonth !a mo% assigns to !a the month stored in %mo. Does not alter other values.
GetMonth !a $b
the contents of variable $b are treated as 'part of the script', i.e. they may reference a time variable or integers.
See also Numeric operations for GetMonth %a and GetMonth %a !b and String operations for GetMonth $a and GetMonth $a !b
GetDay !a
GetLocalDay !a
assigns to !a the current day of the month, does not alter other values. (VRT or Local Time, be careful not to mix them).
GetDay !a !b assigns to !a the day of the month stored in !b. Does not alter other values.
GetDay !a %d assigns to !a the day of the month stored in %d. Does not alter other values.
GetDay !a $b
the contents of variable $b are treated as 'part of the script', i.e. they may reference a time variable or integers.
See also Numeric operations for GetDay %a and GetDay %a !b and String operations for GetDay $a and GetDay $a !b
GetHour !a
GetLocalHour !a
assigns to !a the current hour, does not alter other values. (VRT or Local Time, be careful not to mix them).
GetHour !a !b assigns to !a the hour stored in !b. Does not alter other values.
GetHour !a %h assigns to !a the hour stored in %h. Does not alter other values.
GetHour !a $b
the contents of variable $b are treated as 'part of the script', i.e. they may reference a time variable or integers.
See also Numeric operations for GetHour %a and GetHour %a !b and String operations for GetHour $a and GetHour $a !b
GetMinute !a
GetLocalMinute !a
assigns to !a the current minutes, does not alter other values. (VRT or Local Time, be careful not to mix them).
GetMinute !a !b assigns to !a the minutes stored in !b. Does not alter other values.
GetMinute !a %m assigns to !a the minutes stored in %m. Does not alter other values.
GetMinute !a $b
the contents of variable $b are treated as 'part of the script', i.e. they may reference a time variable or integers.
See also Numeric operations for GetMinute %a and GetMinute %a !b and String operations for GetMinute $a and GetMinute $a !b
GetSecond !a
GetLocalSecond !a
assigns to !a the current seconds, does not alter other values. (VRT or Local Time, be careful not to mix them).
GetSecond !a !b assigns to !a the seconds stored in !b. Does not alter other values.
GetSecond !a %s assigns to !a the seconds stored in %s. Does not alter other values.
GetSecond !a $b
the contents of variable $b are treated as 'part of the script', i.e. they may reference a time variable or integers.
See also Numeric operations for GetSecond %a and GetSecond %a !b and String operations for GetSecond $a and GetSecond $a !b
AddDays !a !b %d
AddHours !a !b %h
AddMinutes !a !b %m
AddSeconds !a !b %s
assigns to !a the value of !b, and adds the correspondind days, hours, minutes or seconds, which can be positive or negative (for substraction).
Future !a !b
LocalFuture !a !b
assigns to !a the value of !b, adjusting the date so that the time period is in the next 24 hours. (VRT or Local Time, be careful not to mix them).
GetTimestamp !a ~b
GetLocalTimestamp !a ~b
assigns to !a the timestamp in object variable ~b in VRT or Local Time. If you need the Unix format, use GetTimestamp %a ~b.
SetTimeout !t
SetTimeout !t $m
Sets a timeout value for the event Timeout, according to the date and time in !t, optionally stores a string which can be recovered at the Timeout event handler with GetMessage $m. The value of !t can also be retrieved there with GetTimeout !t. Does not install the Timeout event.
ClearTimeouts
clears all pending timeout events, see event Timeout.

CONDITIONAL STATEMENTS FOR DATE AND TIME

See Conditional Statements for a general explanation.

IfDate !a IsDate !b statement IfDate compares dates. If the condition is met, the statement is executed. Compares for same date, after of before, within or outside date ranges. Time of day is ignored.
IfDate !a IsAfter !b statement
IfDate !a IsBefore !b statement
IfDate !a IsBetween !b !c statement
IfDate !a IsNotBetween !b !c statement

IfDateTime !a IsAfter !b statement IfDateTime takes both date and time into consideration. If the condition is met, the statement is executed. Note: IsAfter includes the time mentioned, IsBefore excludes it, IsBetween includes the lower but excludes the upper limit.
IfDateTime !a IsBefore !b statement
IfDateTime !a IsBetween !b !c statement
IfDateTime !a IsNotBetween !b !c statement

IfTime !a IsAfter !b statement IfTime compares the time, ignoring the date. If the condition is met, the statement is executed. Note: In contrast to IfDateTime and IfDate, in IfTime !a IsBetween !b !c and IfTime !a IsNotBetween !b !c the order of !b and !c matters: !b will always be considered to be earlier than !c; for example: if !b is at 20 h and !c at 5 h, !b will be taken as being on the previous day .IsAfter includes the time mentioned, IsBefore excludes it, IsBetween includes the lower but excludes the upper limit.
IfTime !a IsBefore !b statement
IfTime !a IsBetween !b !c statement
IfTime !a IsNotBetween !b !c statement
IfIsLeapYear !a statement tests whether the year in !a is leap. If the condition is met, executes statement.
IfIsNotLeapYear !a statement tests whether the year in !a is not leap. If the condition is met, executes statement.


backIndex