%TimeToStrEx function


Function
The function converts given absolute time to a text string according to the defined mask.


Declaration
TEXT %TimeToStrEx(
   TIME in TimeA, 
   TEXT in mask,
   TEXT in timeZone := %GetCurrentTimeZone()
 )
Parameters
TimeAAbsolute time.
maskThe time format of the result string.
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!

Note
Position of individual time components is given by the occurrence of the following strings in the entered mask.

StringDescription
yyyy or rrrr4-digit year representation
yy or rrLast two digits of year
mmMonth
ddDay
hhHour
hb, HHTrading hour - hour in day from 1 to 25.
miMinute
ssSecond
mssMillisecond
ttttName of day in week *.
ttt3-character shortcut of the name of day in week *.
tt2-character shortcut of the name of day in week *.
ZZZUTC offset in hours using format "(+|-)hh".
ZZZZZUTC offset in hours and minutes using format "(+|-)hhmi".
ZZZZZZUTC offset in hours and minutes using format "(+|-)hh:mi".

Only the first appearance of given time component in mask is being replaced. In case of multiple masks of the same time component with different lengths (e.g. yy and yyyy), only the longest one will be replaced.

The function is conformable with the function %TimeToStr, besides the differences during conversions of ambiguous time - changes of daylight saving and standard time - the function displays the time together with the character A or B according to daylight saving time (A) or standard time (B).

A and B characters are used for the transition hour that depends on the time zone. In time zone GTM+1, the character is used at 2 a.m. of the local time. In time zone GMT+2 it is used at 3 a.m. of the local time, etc.

Example: A2:10:00 26-10-2003 (for time zone GMT+1)

If format mask contains UTC offset component, then A/B syntax for ambiguous time is not used.

Example
 %TimeToStrEx(M.TiA_01, "hh:mi:ss.mss dd-mm-rrrr")

0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .