Converting data for datetime values

You can use the library functions dtcvasc(), dtcvfmtasc(), dttoasc(), and dttofmtasc() to explicitly convert between DATETIME column values and character strings.

About this task

For example, you can perform conversions between the DATETIME and DATE data types with library functions and intermediate strings.

To convert a DATETIME value to a DATE value:

Procedure

  1. Use the dtextend() function to adjust the DATETIME qualifier to year to day.
  2. Apply the dttoasc() function to create a character string in the form yyyy-mm-dd.
  3. Use The rdefmtdate() function with a pattern argument of yyyy-mm-dd to convert the string to a DATE value.