Specifying the Format for DATETIME Conversions

Specify the format of the DATETIME input.

Specify the format using:

The length of the format string is the width of the input column.

Option

Meaning

hh

HH

Represents hour, based on 24-hour clock. Always use leading zeros for hour where appropriate, for example '01' for 1 a.m. '00' is also a valid value for 12 a.m.

nn

Represents minute. Always use leading zeros for minute where appropriate, for example, '08' for 8 minutes.

ss[.ssssss]

Represents seconds and fractions of a second.

aa

Represents the a.m. or p.m. designation.

pp

Represents the p.m. designation only if needed. (This is incompatible with SAP Sybase IQ versions earlier than12.0; previously, pp was synonymous with aa.)

hh

SAP Sybase IQ assumes zero for minutes and seconds. For example, if the DATETIME value you enter is '03', SAP Sybase IQ converts it to '03:00:00.0000'.

hh:nn or hh:mm

SAP Sybase IQ assumes zero for seconds. For example, if the time value you enter is '03:25', SAP Sybase IQ converts it to '03:25:00.0000'.

Sample DATETIME format options show how time input data may look and how to specify the format for the DATETIME option.

Input Data

Format Specification

12/31/00 14:01:50

DATETIME ('MM/DD/YY hh:nn:ss')

123100140150

DATETIME ('MMDDYYhhnnss')

14:01:50 12-31-00

DATETIME ('hh:mm:ss MM-DD-YY')

12/31/00 14:01:12.456

DATETIME ('MM/DD/YY hh:nn:sssssss')

12/31/00 14:01:.123456

DATETIME ('MM/DD/YY hh:mm:sssssss')

12/31/00 02:01:50AM

DATETIME ('MM/DD/YY hh:mm:ssaa')

12/31/00 02:01:50pm

DATETIME ('MM/DD/YY hh:mm:sspp')

General rules for specifying dates include: