HDTTM: Converting a Date Value to a Date-Time Value

How to:

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


Top of page

x
Syntax: How to Convert a Date Value to a Date-Time Value
HDTTM(date, length, output)

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 length of the returned date-time value. Valid values are:

  • 8 indicates a time value that includes milliseconds.
  • 10 indicates a time value that includes microseconds.
  • 12 indicates a time value that includes nanoseconds.
output

Date-time

Is the generated date-time value. The value must have a date-time format (data type H).



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