CTODT( ) example
"Character to DateTime" can be used to convert date and time values to a DateTime value. The following statements convert and combine date( ) and TTIME( ) values to DateTime.
datevalue=date() //Assigns todays date to "datevalue"
datevalue=dtoc(datevalue) //Converts date to character string
timevalue=TTIME() //Assigns the current time to
"timevalue"
timevalue=ttoc(timevalue) //Converts time to character string
datetime=CTODT(datevalue+" "+timevalue) //Combines date and time, separated
by "space". Converts to DateTime.
Note
Omitting the "space" in the above code will cause the timevalue component to revert to 12:00:00 AM.