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


Converts a TIMESTAMP variable into a string.


TimestampToStr(Timestamp, INT Format [, INT UTC])


Specifies the TIMESTAMP variable.


The format number determines which of date/time patterns are used for formatting returned string. Date/time patterns are defined in regional settings on a particular computer and can vary depend on national or individual preferences. The possible format numbers together with examples based on en-US regional settings are listed below:

0 – Short time format, hh:mm.

1 – Long time format, hh:mm:ss.

2 – Short date format, dd/MM/yyyy.

3 – Long date format, dddd, dd MMMM yyyy.

4 – Short date & short time format, dd/MM/yyyy hh:mm.

5 – Short date & long time format, dd/MM/yyyy hh:mm:ss.

6 – Long date & short time format, dddd, dd MMMM yyyy hh:mm.

7 – Long date & long time format, dddd, dd MMMM yyyy hh:mm:ss.

8 – Month day format, dd MMMM.

9 – Year month format, MMMM yyyy.

10 – RFC1123 format, ddd, dd MMM yyyy hh:mm:ss GMT

11 – Sortable date time format, yyyy-MM-ddThh:mm:ss

12 – Short universal format, yyyy-MM-dd hh:mm:ssZ

13 – Long universal format, dddd, dd MMMM yyyy hh:mm:ss

14 – Long Time & millisecond, hh:mm:ss.fff

UTC (optional - short for Universal Time Coordinate):

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

1 - Display the string as a UTC date/time.

Return Value

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

Related Functions

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


TIMESTAMP t1 = TimestampCreate(2009,07,11,09,27,34,123);
STRING sTimestamp = TimestampToStr(t1, 0, 0);
// sTimestamp equals '9:27 AM'

See Also

Timestamp Functions