DTIME: Extracting Time Components From a Date-Time Value

How to:

Given a date-time value and time component keyword as input, DTIME returns the value of all of the time components up to and including the requested component. The remaining time components in the value are set to zero. The field to which the time component is returned must have a time format that supports the component being returned.

Syntax: How to Extract a Time Component From a Date-Time Value

DTIME(datetime, component)

where:

datetime

Date-time

Is the date-time value from which to extract the time component. It can be a field name or a date-time literal. It must provide a full component date.

component

Keyword

Valid values are:

  • TIME. The complete time portion is returned. Its smallest component depends on the input date-time format. Nanoseconds are not supported or returned.
  • HOUR. The time component up to and including the hour component is extracted.
  • MINUTE. The time component up to and including the minute component is extracted.
  • SECOND. The time component up to and including the second component is extracted.
  • MILLISECOND. The time component up to and including the millisecond component is extracted.
  • MICROSECOND. The time component up to and including the microsecond component is extracted.

Example: Extracting Time Components

DTIME extracts the TIME component from the data-time value 2018/01/17 05:45:22.777888.

DTIME(DT(2018/01/17 05:45:22.777888), TIME)

The result is 05:45:22.777888.

WebFOCUS

Feedback