Cicode Programming Reference > Cicode Function Categories > Timestamp Functions > TimestampFormat

TimestampFormat

Format a TIMESTAMP variable into a string.

Syntax

TimestampFormat(TIMESTAMP Timestamp, STRING Format [, INT UTC])

Timestamp:

The timestamp variable.

Format:

The format of the string is the same as .NET Framework DateTime format. Specifically be reminded that the format is case sensitive. For example 'MM' is the zero padded month number, whereas 'mm' is the zero padded current minute within the hour. Therefore no Year, Day or Seconds will be displayed if they are specified in uppercase as: YYYY, DD, SS. The correct display will only occur when they are specified in lowercase as: yyyy, dd, ss.

A short list of formats are included below extracted from the"Custom Date and Time Format Strings" in the Microsoft .NET Framework Developer's Guide from the MSDN Library. It is recommended that you confirm its currency by consulting the source information periodically.

Use the following single-character format strings by themselves to choose predefined standard date and time formats:

UTC:

Coordinated Universal Time (optional):

0 - Returns the time as a local date/time (default).

1 - Returns the time as a UTC date/time.

Return Value

A string containing the converted time/date, or an empty string if invalid.

Related Functions

TimestampAdd, TimestampCurrent, TimestampDifference, TimestampSub, TimestampToStr, TimestampCreate, TimestampGetPart, TimestampToTimeInt, TimeIntToTimestamp

Example

TIMESTAMP t1 = TimestampCreate(2009,07,11,09,27,34,123);
STRING sTimestamp = TimestampFormat(t1, "dd/MM/yyyy hh:mm:ss.fff");
// sTimestamp equals "11/07/2009 09:27:34.123"

See Also

Timestamp Functions

 

Published June 2018