ACL uses serial datetimes to store dates, datetimes, and times. Subtraction operations that involve only date, datetime, or time values return results in the form of a serial datetime.

Serial datetimes are numbers that use integers to represent dates, and a decimal fractional portion of 24 hours to represent times – for example, 42004, 42004.50000, or 0.75000. The portion before the decimal point is the date, and the portion after the decimal point is the time.

The date portion is the number of days that have elapsed since 01 January 1900. Therefore, a serial date of ‘1’ is equivalent to 02 January 1900. A serial date of ‘0’ (zero) is not counted. A serial date of ‘42004’ is equivalent to 01 January 2015.

The time portion of serial datetimes uses the 24-hour clock. So, 0.5 is equivalent to 12 hours, 0.75 is equivalent to 18 hours, 0.04167 is equivalent to 1 hour, and so on.

The serial datetimes above are equivalent to the following regular datetime values:

• 42004 = 01 January 2015

• 42004.50000 = 01 January 2015 12:00:00

• 0.75000 = 18:00:00

## STOD, STODT, and STOT conversion functions

Three conversion functions allow you to convert serial datetimes into regular datetime values with a Datetime data type: STOD( ), STODT( ), and STOT( ). The function names are abbreviations for “Serial to Date”, “Serial to Datetime”, and “Serial to Time”. You might want to convert serial datetimes to make results of some datetime expressions more human-readable, or to convert a Numeric serial datetime value to a Datetime data type for use in another expression that requires a Datetime data type. The table below shows examples of the three functions.

For more information about the STOD( ), STODT( ), and STOT( ) functions, see the ACL Language Reference.

Expression

Results

STOD(42004)

01 Jan 2015

STODT(42004.50000)

01 Jan 2015 12:00:00

STOT(0.75000)

18:00:00

STOT(`T173000` - `T093000`)

08:00:00

Related concepts
Using datetimes in expressions
Related reference
STOD( ) function
STODT( ) function
STOT( ) function