%StrToTimeEx function


Old name
%MkATEx


Function
The function converts a text string to a value of Absolute time type according to a given mask.
Declaration
TIME %StrToTimeEx(
   TEXT in String1, 
   TEXT in String2,
   TEXT in timeZone := %GetCurrentTimeZone()
 )
Parameters
string1Text string.
string2Mask. See the description of the mask for the %TimeToStr function
Note: "UNIX" and "UNIXMS" masks are also supported for Unix timestamp conversion (number of seconds or milliseconds from 1.1.1970 UTC)
timeZone

Name of the time zone used for conversion to local time (e.g. "Europe/London") or definition of fixed offset from UTC using format "(+|-)hh[:mi[:ss]]", where hh defines a number of hours, mi defines a number of minutes, and ss defines a number of seconds. Sign as well as a number of hours are mandatory parts of offset definition, number of minutes and seconds are optional and default to 0 (e.g. "+02:30" defines offset of 2 hours and 30 minutes from UTC). The empty text has the same meaning as function %GetCurrentTimeZone.
Note: For historical reasons, an integer parameter is also accepted. Its interpretation is as follows: 0 - zone "Europe/London", 3600 - zone "Europe/Bratislava", 7200 - zone "Europe/Kiev", 21600 - zone "Asia/Almaty". Usage of integer parameter is deprecated and generates warning into log file!

Description
In case of an ambiguous time, the function returns standard time (i.e. later time). Ambiguous time can be labeled with the character A - for daylight-saving time and B - for standard time.

The ambiguous time is distinguished by the characters A and B (A - summer time and B - standard time), in the place of hours. For example: In time zone GMT+1 at 2 a.m. of the local time, the ambiguous time is defined as A2 and B2. In time zone GMT+2 at 3 a.m. of the local time, it is defined as A3 and B3, etc.

For a time that is missing or does not exist, it returns invalid value.

Example
%StrToTimeEx("17:03:16 18-03-99",  "hh:mi:ss dd-mm-rr")
Napíšte komentár