Required formats for date, time, and timestamp information

Your edit routine can format data from datetime columns, just as it can format data from columns with other data types. The one difference is that the value to be formatted, which appears in the control block field ECSINPT, is always passed as a character string, whether the code to be processed is a U code or a V code.

The expected format of the string is described in this table.

Table 1. Formatting DATE, TIME, and TIMESTAMP data
Data type Form of the string
DATE data

yyyy-mm-dd where:

yyyy
Specifies the year. It is always a four-digit number.
mm
Specifies the month (01 for January, 12 for December). It is always a two-digit number that can contain a leading zero.
dd
Specifies the day of the month. It is always a two-digit number that can contain a leading zero.

The dashes (-) represent true dashes.

For example, 2006-03-12 is the date March 12, 2006.

TIME data

hh.mm.ss where:

hh
Specifies the hour (based on a 24-hour clock, from 00 to 23). It is always a two-digit number that can contain a leading zero.
mm
Specifies the minute. It is always a two-digit number that can contain a leading zero.
ss
Specifies the second. It is always a two-digit number that can contain a leading zero.

The periods represent true periods.

For example, 13.08.36 is 1:08 P.M. and 36 seconds in the notation commonly used in the United States.

TIMESTAMP data

yyyy-mm-dd-hh.mm.ss.nnnnnnnnnnnn where:

yyyy-mm-dd
Specifies the date in the same way as for DATE data.
hh.mm.ss
Specifies the time of day in the same way as for TIME data.
nnnnnnnnnnnn
Specifies a 0-digit to 12-digit number that represents the number of fractional seconds.

For example, 2010-09-30-13.08.36.123456654321 is 1:08 P.M. and 36.123456654321 seconds on September 30, 2010, in the notation commonly used in the United States.

TIMESTAMP WITH TIME ZONE data

yyyy-mm-dd-hh-mm-ss-nnnnnnnnnnnnzth:tm

yyyy-mm-dd
Specifies the date in the same way as for DATE data.
hh.mm.ss
Specifies the time of day in the same way as for TIME data.
nnnnnnnnnnnn
Specifies a 0-digit to 12-digit number that represents the number of fractional seconds.
z
A plus (+) or minus (-) sign that indicates the time zone offset relative to Coordinated Universal Time (UTC), formerly known as Greenwich Mean Time (GMT).
th
A two-digit value representing the time zone hours.
tm
A two-digit value representing the time zone minutes.

The valid range for the time zone portion of the format is from -24:00 to +24:00. To specify UTC, you can either specify a time zone of -0:00 or +0:00 or replace the time zone offset and its sign with an uppercase Z.

For example, 2010-09-30-13.08.36.123456654321-08:00 indicates a time of 1:08 P.M. and 36.123456654321 seconds on September 30, 2010, in San Jose, California, in the United States. The timestamp 2010-09-30-13.08.36.123456654321Z indicates a time of 1:08 P.M. and 36.123456654321 seconds wherever UTC is in effect.