AppLib TIMESTAMP TO CHAR
From Eigenpedia
(Redirected from LucidDbAppLib TIMESTAMP TO CHAR)
Contents |
Syntax
APPLIB.TIMESTAMP_TO_CHAR ( format, timestamp )
Purpose
Uses a format string to format a timestamp. Returns the formatted timestamp or portion of a timestamp as a string.
Parameters
- format: format string used to format the timestamp. [VARCHAR] Any combination of the following fields in the table below can be added to a format string. NOTE: the format string is case sensitive.
| Field | Full Form | Short Form |
|---|---|---|
| Year | yyyy (4 digits) | yy (2 digits) |
| Month | MMM (name) | MM (2 digits), M (1 or 2 digits) |
| Day of week | EEEE | EE |
| Day of month | dd (2 digits) | d (1 or 2 digits) |
| Hour (1-12) | hh (2 digits) | h (1 or 2 digits) |
| Hour (0-23) | HH (2 digits) | H (1 or 2 digits) |
| Hour (0-11) | KK | K |
| Hour (1-24) | kk | k |
| Minute | mm | |
| Second | ss | |
| Millisecond | SSS | |
| AM/PM | a | |
| Time zone | zzzz | zz |
| Day of week in month | F (e.g., 3rd Thursday) | |
| Day in year | DDD (3 digits) | D (1, 2, or 3 digits) |
| Week in month | WW | |
| Week in year | ww | |
| Era (BC/AD) | G |
- timestamp: the timestamp to be formatted [TIMESTAMP]
- RETURN: formatted timestamp or portion of a timestamp [VARCHAR]
Example
VALUES( APPLIB.TIMESTAMP_TO_CHAR('EE, MMM d yyyy - hh:mm:ss a', TIMESTAMP'2006-10-4 11:15:00'),
APPLIB.TIMESTAMP_TO_CHAR('yyyy', TIMESTAMP'2006-10-4 11:15:00') )
RETURNS:
| APPLIB.TIMESTAMP_TO_CHAR('EE, MMM d yyyy - hh:mm:ss a', TIMESTAMP'2006-10-4 11:15:00') | APPLIB.TIMESTAMP_TO_CHAR('yyyy', TIMESTAMP'2006-10-4 11:15:00') |
|---|---|
| Wed, Oct 4 2006 - 11:15:00 AM | 2006 |

