Time2Num

Returns the number of milliseconds since the epoch, given a time string.

Syntax

Time2Num(d [, f [, k ]])

Parameters

Parameter

Description

d

A time string in the format supplied by f that also conforms to the locale given by k.

f (Optional)

A time format string. If you do not include a value for f, the function uses the default time format H:MM:SS A.

k (Optional)

A locale identifier string that conforms to the locale naming standards. If you do not include a value for k, or if k is invalid, the function uses the ambient locale.

The function returns a value of 0 if any of the following conditions are true:

  • The format of the given time does not match the format specified in the function.

  • Either the locale or time format supplied in the function is invalid.

    Insufficient information is provided to determine a unique time since the epoch (that is, any information regarding the time is missing or incomplete.

Examples

The following expressions illustrate using the Time2Num function:

Expression

Returns

Time2Num("00:00:00 GMT", "HH:MM:SS Z")

1

Time2Num("1:13:13 PM")

76393001 to a user in California on Pacific Standard Time, and 76033001 when that same user is on Pacific Daylight Savings Time.

Time2Num("13:13:13", "HH:MM:SS") - Time2Num("13:13:13 GMT", "HH:MM:SS Z")) / (60 * 60 * 1000)

8 to a user in Vancouver and 5 to a user in Ottawa when on Standard Time. On Daylight Savings Time, the returned values are 7 and 4, respectively.

Time2Num("13:13:13 GMT", "HH:MM:SS Z", "fr_FR")

47593001

// Ethnio survey code removed