Parent Previous Next


The Datetime type represents a fixed point in time (a calendar time) specified by a date and time. Dates are based on the Gregorian calendar and time is based on a 24-hour clock with the smallest unit being the millisecond. Datetime variables can be used in expressions to calculate datetime or timespan values using simple arithmetic.

Type Specification.

Details of the type and the supported operators:




Standard Type

Value range: 1/1-0001 00:00:00.000 to 31/12-9999 23:59:59.999.





x.y   foo(x)


+   -


<   >    <=   >=


==   <>


:=    +=    -=

Using Datetime Variables.

A datetime variable has no default value - it is initially empty. It must be assigned a value before taking part in expressions, otherwise a runtime error will occur during the VM execution.

Value assignment is done using one of the built-in standard functions or as a result of a calculation.

When working with datetime calculations it is imperative to have a good understanding of the Timespan type, because certain operations involving datetime values may require or produce timespan values.

The compiler is designed to validate the supported operations in order to catch most problems at the time of compilation, instead of having to wait for any runtime errors to appear during execution.

The rules and supported operations for using datetime and timespan values are closely interconnected and are presented in detail in the Timespan description, which also exemplifies how to work with a mix of datetime and timespan variables.

Standard Functions.

The next pages describe all the standard functions recognized by the compiler as member-functions of the Datetime type.