Difference between revisions of "TTOC()"
Helen.george (Talk | contribs) |
Yvonne.milne (Talk | contribs) (→Description) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
==See Also== | ==See Also== | ||
− | [[AMPM()]], [[CDOW()]], [[CMONTH()]], [[CTOD()]], [[CTOT()]], [[DATE()]], [[DATETIME()]], [[DAY()]], [[DAYS()]], [[DMY()]], [[DOW()]], [[DTOC()]], [[DTOM()]], [[DTOS()]], [[DTOV()]], [[ELAPTIME()]], [[EMPTY()]], [[EPOCH()]], [[GOMONTH()]], [[HOUR()]], [[HOURS()]], [[LTOS()]], [[MDY()]], [[MINUTE()]], [[MINUTES()]], [[MONTH()]], [[MTOD()]], [[MTOS()]], [[QUARTER()]], [[SEC()]], [[SECONDS()]], [[SECS()]], [[ | + | [[AMPM()]], [[CDOW()]], [[CMONTH()]], [[CTOD()]], [[CTOT()]], [[DATE()]], [[DATETIME()]], [[DAY()]], [[DAYS()]], [[DMY()]], [[DOW()]], [[DTOA()]], [[DTOC()]], [[DTOM()]], [[DTOS()]], [[DTOT()]], [[DTOV()]], [[ELAPTIME()]], [[EMPTY()]], [[EPOCH()]], [[GOMONTH()]], [[HOUR()]], [[HOURS()]], [[ISLEAPYEAR()]], [[LEAPYEARS()]], [[LTOS()]], [[MDY()]], [[MINUTE()]], [[MINUTES()]], [[MONTH()]], [[MTOD()]], [[MTOS()]], [[QUARTER()]], [[SEC()]], [[SECONDS()]], [[SECS()]], [[SET CENTURY]], [[SET DATE]], [[SET EPOCH]], [[SET HOURS]], [[SET MARK]], [[SET SECONDS]], [[STOD()]], [[STOT()]], [[STR()]], [[STRFTIME()]], [[TIME()]], [[TIMEOFDAY()]], [[TIMESTAMP()]], [[TSTRING()]], [[TTOD()]], [[TYPE()]], [[VAL()]], [[VALIDTIME()]], [[VTOD()]], [[WEEK()]], [[YEAR()]] |
==Description== | ==Description== | ||
− | The TTOC() function converts the datetime expression <expT> to a string value. By default, the date part of the string returned will conform to the current SET DATE, SET MARK and SET CENTURY settings, in the same format as DTOC(). The time will be returned in the format hh:mm:ss AM|PM. If the expression to be converted contains no time information, 12:00:00 AM will be assumed. If SET SECONDS is OFF (ON by default), no seconds will be displayed. The SET HOURS set command determines whether hours are shown in 24 hour format or in 12 hour format with AM | PM postfix. | + | The TTOC() function converts the datetime expression <expT> to a string value. By default, the date part of the string returned will conform to the current [[SET DATE]], [[SET MARK]] and [[SET CENTURY]] settings, in the same format as [[DTOC()]]. The time will be returned in the format hh:mm:ss AM | PM. If the expression to be converted contains no time information, 12:00:00 AM will be assumed. If [[SET SECONDS]] is OFF (ON by default), no seconds will be displayed. The [[SET HOURS]] set command determines whether hours are shown in 24 hour format or in 12 hour format with AM | PM postfix. |
<expN> | <expN> | ||
Line 19: | Line 19: | ||
|0||As defaults | |0||As defaults | ||
|- | |- | ||
− | |1||YYYYMMDDhhmmss | + | |1||YYYYMMDDhhmmss (this 14 character format is not affected by the [[SET CENTURY]], [[SET HOURS]] or [[SET SECONDS]] commands). |
|- | |- | ||
− | |valign="top"|2||Time only: hh:mm:ss AM | + | |valign="top"|2||Time only: hh:mm:ss AM | PM ([[SET SECONDS]] ON) or hh:mm AM | PM ([[SET SECONDS]] OFF) |
− | or hh:mm AM | + | |- |
+ | |3||YYYYMMDD hh:mm:ss | ||
+ | |- | ||
+ | |4||YYYY-MM-DDThh:mm:sssZ | ||
|- | |- | ||
|} | |} | ||
Line 35: | Line 38: | ||
? ttoc({^2004-03-29 10:15:43 AM},2) | ? ttoc({^2004-03-29 10:15:43 AM},2) | ||
10:15:43 AM | 10:15:43 AM | ||
+ | ? ttoc({^2004-03-29 10:15:43 AM},3) | ||
+ | 20040329 10:15:43 | ||
+ | ? ttoc({^2004-03-29 10:15:43 AM},4) | ||
+ | 2004-03-29T10:15:43.000Z | ||
</code> | </code> | ||
Latest revision as of 07:58, 2 January 2020
Contents
Purpose
Function to convert a datetime expression to a string value in an optionally specified format
Syntax
TTOC(<expT> [, <expN>])
See Also
AMPM(), CDOW(), CMONTH(), CTOD(), CTOT(), DATE(), DATETIME(), DAY(), DAYS(), DMY(), DOW(), DTOA(), DTOC(), DTOM(), DTOS(), DTOT(), DTOV(), ELAPTIME(), EMPTY(), EPOCH(), GOMONTH(), HOUR(), HOURS(), ISLEAPYEAR(), LEAPYEARS(), LTOS(), MDY(), MINUTE(), MINUTES(), MONTH(), MTOD(), MTOS(), QUARTER(), SEC(), SECONDS(), SECS(), SET CENTURY, SET DATE, SET EPOCH, SET HOURS, SET MARK, SET SECONDS, STOD(), STOT(), STR(), STRFTIME(), TIME(), TIMEOFDAY(), TIMESTAMP(), TSTRING(), TTOD(), TYPE(), VAL(), VALIDTIME(), VTOD(), WEEK(), YEAR()
Description
The TTOC() function converts the datetime expression <expT> to a string value. By default, the date part of the string returned will conform to the current SET DATE, SET MARK and SET CENTURY settings, in the same format as DTOC(). The time will be returned in the format hh:mm:ss AM | PM. If the expression to be converted contains no time information, 12:00:00 AM will be assumed. If SET SECONDS is OFF (ON by default), no seconds will be displayed. The SET HOURS set command determines whether hours are shown in 24 hour format or in 12 hour format with AM | PM postfix.
<expN> The optional <expN> can be used to specify the format of the return value:
<expN> | Format |
---|---|
0 | As defaults |
1 | YYYYMMDDhhmmss (this 14 character format is not affected by the SET CENTURY, SET HOURS or SET SECONDS commands). |
2 | Time only: hh:mm:ss AM | PM (SET SECONDS ON) or hh:mm AM | PM (SET SECONDS OFF) |
3 | YYYYMMDD hh:mm:ss |
4 | YYYY-MM-DDThh:mm:sssZ |
Example
set date american ? ttoc({^2004-03-29 10:15:43 AM}) 03/29/2004 10:15:43 AM ? ttoc({^2004-03-29 10:15:43 AM},1) 20040329101543 ? ttoc({^2004-03-29 10:15:43 AM},2) 10:15:43 AM ? ttoc({^2004-03-29 10:15:43 AM},3) 20040329 10:15:43 ? ttoc({^2004-03-29 10:15:43 AM},4) 2004-03-29T10:15:43.000Z