HDTTM: Converting a Date to a Timestamp

How to:

The HDTTM function converts a date value to a timestamp value. The time portion or timestamp is set to midnight.


Top of page

x
Syntax: How to Convert a Date to a Timestamp
HDTTM(date, length, output_format)

where:

date

Date

Is the date to be converted. It must be a full component format date. For example, it can be MDYY or YYJUL.

length

Integer

Is the number of characters returned as the timestamp. Valid values are:

8 for a timestamp in date-time format that includes milliseconds.
10 for a timestamp in date-time format that includes microseconds.

output_format

Date-Time

Is the newly created timestamp.



Example: Converting a Date to a Timestamp

This example converts the President's Day date into a timestamp:

TS/HYYMDS = HDTTM('February 16 2004', 8, TS)

the function returns 2004/02/16 00:00:00 and assigns this timestamp to field TS. Note the zero values of time components in the timestamp. Also note the use of natural date constants in single quotation marks for the date in the first function parameter.


iWay Software