STOT( ) function

Converts a serial time – that is, a time expressed as a fractional portion of 24 hours, with 24 hours equaling 1 – to a time value. Abbreviation for "Serial to Time".

Syntax

STOT(serial_time)

Parameters

Name Type Description
serial_time

numeric

The field, expression, or literal value to convert.

serial_time can be a serial time or a serial datetime. Only the time portion of serial datetimes is considered. The date portion is ignored.

Output

Datetime. The time value is output using the current Analytics time display format.

Examples

Basic examples

Returns `t060000` displayed as 06:00:00 AM assuming a current Analytics time display format of hh:mm:ss PM:

STOT(0.25000)

Returns `t191530` displayed as 07:15:30 PM assuming a current Analytics time display format of hh:mm:ss PM:

STOT(0.802431)

Returns the equivalent regular time for each serial time value in the Login_time field:

STOT(Login_time)

Remarks

When to use STOT( )

Use the STOT( ) function to convert serial times to regular times.

What are serial times?

Analytics serial times represent a fractional portion of 24 hours, with 24 hours equaling 1.

For example:

  • the serial time equivalent of 1 hour is 1/24, or 0.04167
  • the serial time equivalent of 1 minute is 1/1440, or 0.0006945

Serial times can be prefaced with a '0' (zero) and a decimal point, or just a decimal point.

1.000000 is not a valid serial time

Although 24 hours equals 1 for the purposes of calculating serial times, 1.000000 is not a valid serial time. Valid serial times are all decimal fractions less than 1. For example: 0.75000 (06:00:00 PM).

Analytics treats the serial number 1.000000 as the serial datetime equivalent to 02 Jan 1900 12:00:00 AM. Because STOT( ) ignores the date portion of datetimes, STOT(1.000000) is equivalent to STOT(0.000000) and both are equivalent to the regular time 12:00:00 AM.

Serial times and regular time equivalents

Serial time

Regular time equivalent

0.00

12:00:00 AM

0.0006945

12:01:00 AM

0.04167

01:00:00 AM

0.0423645

01:01:00 AM

0.042998

01:01:55 AM

0.25

06:00:00 AM

0.50

12:00:00 PM

0.75

06:00:00 PM

0.79167

07:00:00 PM

0.802431

07:15:30 PM

1.00

12:00:00 AM

Other datetime conversion functions

Serial to Datetime conversion

Function Description

STOD( )

Converts a serial date – that is, a date expressed as an integer – to a date value. Abbreviation for "Serial to Date".

STODT( )

Converts a serial datetime – that is, a datetime expressed as an integer, and a fractional portion of 24 hours – to a datetime value. Abbreviation for "Serial to Datetime".

Character or Numeric to Datetime conversion

Function Description

CTOD( )

Converts a character or numeric date value to a date. Can also extract the date from a character or numeric datetime value and return it as a date. Abbreviation for "Character to Date".

CTODT( )

Converts a character or numeric datetime value to a datetime. Abbreviation for "Character to Datetime".

CTOT( )

Converts a character or numeric time value to a time. Can also extract the time from a character or numeric datetime value and return it as a time. Abbreviation for "Character to Time".

Datetime to Character conversion

Function Description

DATE( )

Extracts the date from a specified date or datetime and returns it as a character string. Can also return the current operating system date.

DATETIME( )

Converts a datetime to a character string. Can also return the current operating system datetime.

TIME( )

Extracts the time from a specified time or datetime and returns it as a character string. Can also return the current operating system time.

ACL Scripting Guide 14.1