XFA Specification
Chapter 23, FormCalc Specification
Date And Time Built-in Functions
853
Time2Num()
This function returns the number of milliseconds since the
epoch,
given a time string.
Syntax
Time2Num(d1[, f1[, k1]])
Parameters
d1
is a time string in the format given by f1, governed by the locale given by k1.
f1
is a time picture clause, as
defined
above.
If f1 is omitted, the
default time picture clause
is used.
k1
is a locale identifier string, as described in
“Specifying a Locale (Locale Identifier String)” on page 828.
If k1 is omitted, the
prevailing locale
Returns
The milliseconds from the
epoch
or null if any of its parameters are null.
If the time string does not include a timezone, the current timezone is used.
The locale is used to parse any timezone names.
If the given time is not in the format given, or the format is invalid, or the locale is invalid, the function
returns 0.
Sufficient information must be provided to determine a second since the epoch: if any of the hour of the
meridiem, minute of the hour, second of the minute, and meridiem are missing, or any of the hour of the
day, minute of the hour, and second of the minute are missing, the function returns 0.
Examples
Time2Num("00:00:00 GMT", "HH:MM:SS Z")
returns 1.
Time2Num("1:13:13 PM")
returns 76393001 to a user in California on Standard Time, and 76033001 when that same user is on
Daylight Savings Time.
(Time2Num("13:13:13", "HH:MM:SS") - Time2Num("13:13:13 GMT", "HH:MM:SS Z")) / (60 * 60 * 1000)
returns 8 to a user in Vancouver and returns 5 to a user in Ottawa when on Standard Time. On Daylight
Savings Time, the returned values are returns 7 and 4, respectively.
Time2Num("1.13.13 dC GMT+01:00", "h.MM.SS A Z", "it_IT")
returns 43993001.