LucidDbAppLib TIME TO CHAR

From Eigenpedia

Jump to: navigation, search

Contents

Syntax

APPLIB.TIME_TO_CHAR ( format, time )

Purpose

Uses a format string to format a time. Returns the formatted time or portion of a time as a string.

Input

  • format [VARCHAR(65535)]: format string used to format the time. NOTE: the format string fields are case sensitive.
  • time [TIME]: the time to be formatted


Format String Syntax

Any combination of the following fields in the table below can be added to a format string.

Field Full Form Short Form
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
AM/PM a


Output

  • [VARCHAR(65535)]: formatted time or portion of a time


Example

VALUES( APPLIB.TIME_TO_CHAR('h:mm:ss a', TIME'14:15:00'),
    APPLIB.TIME_TO_CHAR('kk - mm - ss - SSS zzzz', TIME'1:15:00') )

RETURNS:

APPLIB.TIME_TO_CHAR('h:mm:ss a', TIME'14:15:00') APPLIB.TIME_TO_CHAR('kk - mm - ss - SSS zzzz', TIME'1:15:00')
2:15:00 PM 01 - 15 - 00 - 000 Pacific Standard Time

Untried/Untested functionality

The functionality listed under this section has not been fully tested and is not considered supported at this time. The expected behavior for the usage patterns below have not been well-specified and they should be used at your own risk.

This functions uses [java.text.SimpleDateFormat] for parsing, check the documentation for further possible patterns

Source Code

http://p4web.eigenbase.org/open/dev/luciddb/src/com/lucidera/luciddb/applib/datetime/StdConvertDateUdf.java


Return to LucidDbAppLib page

Personal tools