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

TimestampFormat

Format a TIMESTAMP variable into a string.

Syntax

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

Timestamp:

The timestamp varible.

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.

For more details regarding this format refer to "Custom Date and Time Format Strings" in the Microsoft .NET Framework Developer's Guide from the MSDN Library.

UTC:

Universal Time Co-ordinate (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