Reading, Writing, and Converting Timestamps

This section describes the rules for working with timestamps in Sybase CEP.

Internally, timestamps are always stored as the number of microseconds since midnight January 1, 1970 UTC/GMT. (This time is referred to as "the beginning of the epoch".) This is true for columns of type TIMESTAMP and for the internal row timestamp.

Although internally timestamps are always stored in UTC/GMT, when timestamps are converted to or from a string (for example, "2010-12-31 13:00:00.000000") the time zone is taken into account. The rules used in converting between internal timestamps and strings are shown below:

For example, if you enter the timestamp as 0 microseconds and convert this to U.S. Pacific Standard Time (which is 8 hours behind UTC/GMT) using a format specifier "YYYY-MM-DD HH24:MI:SS TZD" the resulting string will be "1969-12-31 16:00:00 PST".

Generally, you don't need to deal with the internal timestamps, but you should either:

If all of your work is done in the same time zone (for example, your company has one office, and all dates and times are entered as local time), you may not need to specify time zone information. However, if you have multiple offices, or if you enter times and dates for customers in different time zones, you need to specify the time zone in the format specifier and in the data that you enter.

These rules apply to all adapters that use, read or write timestamp information as a string.

For more information about time zones, see Daylight Savings Time and the Time Zone Database in this manual.

For more information about how to specify timestamp formats, see the appropriate appendix in the Sybase CEP CCL Reference Guide .