TEXTTODATE

The TEXTTODATE function converts text item from CCYYMMDD or YYMMDD format to a date.

You can use the TEXTTODATE to convert a text item to a date, however, the TODATETIME function provides greater flexibility for specifying the resulting date-time format .

Syntax:
TEXTTODATE ( single-text-expression )
Meaning:
TEXTTODATE ( text_to_convert_to_date )
Returns:
A single date

The text_to_convert_to_date must be in either CCYYMMDD or YYMMDD format. If the text_to_convert_to_date is in error (for example, it is not a valid date), the result is "none".

If text_to_convert_to_date is in YYMMDD format and is being assigned to a date format that includes a century, the century is determined based on the century run option setting using the CCLookup parameter or the current century.

Examples

  • TEXTTODATE ( "990114" )

    Returns a single date item with the value of January 14 in the year 99

  • TEXTTODATE ( OrderDate )

    Returns OrderDate as a single date item.

Related functions

  • DATETOTEXT
  • TEXTTOTIME
  • NUMBERTOTEXT
  • TIMETOTEXT
  • TEXTTONUMBER
  • TODATETIME