Data Transformation Engine Functions and Expressions Reference Guide
Chapter 3 - Function Reference TODATETIME
Functions and Expressions Reference Guide
208
TODATETIME
The TODATETIME function converts a text string of a specified format to a
date/time.
Syntax
TODATETIME ( single-character-text-expression
[ , single-text-expression ] )
Meaning
TODATETIME ( text_to_convert [ , date_time_format_string ] )
Returns
This function returns a single-character_date_item.
Returns the date/time that corresponds to the value specified by
text_to_convert, which is in the format specified by date_time_format_string.
If date_time_format_string is not specified, it will be assumed that
text_to_convert is in [CCYYMMDDHH24MMSS] format.
The date_time_format_string must conform to the date/time format strings as
described in Appendix B – Format Strings.
Examples
TODATETIME ( "05/14/1999@10:14pm" ,
"{MM/DD/CCYY}@{HH12:MMAM/PM}" )
In this example, a text string containing a date and time is converted to a
date/time item.
RptDate = TODATETIME ( RIGHT ( GETRESOURCENAME() , 8 ) ,
"CCYYMMDD" )
Assume that you receive a file that contains historical data. The name of the
file identifies the date of the historical data. For example, a filename of
19960424 indicates that the data was produced on April 24, 1996. To map
this date to RptDate, the
TODATETIME function could be used with the RIGHT
and
GETRESOURCENAME functions.