DATETOTEXT

The DATETOTEXT function converts a date object or expression to a text item.

Syntax:
DATETOTEXT (single-date-expression)
Meaning:
DATETOTEXT (date_to_convert)
Returns:
A single text item

If date_to_convert is a date object name, this returns the date as a text item formatted according to the presentation of the date object.

If date_to_convert is a date expression produced by a function, this returns the date as a text item formatted according to the presentation of the output argument of that function.

Examples

  • DATETOTEXT ( ShipDate )

    In this example, ShipDate is converted from a date to text. If ShipDate has a CCYYMMDD presentation, the resulting text item will have that presentation, as well.

  • DATETOTEXT ( CURRENTDATETIME ( "{MM/DD/CCYY}" ) )

    In this example, CURRENTDATETIME evaluates and returns a date in MM/DD/CCYY format. Then DATETOTEXT evaluates and returns a text string that is that date in MM/DD/CCYY format.

    For example, use DATETOTEXT, to do text concatenation. The FROMDATETIME function provides greater flexibility in specifying the format of the resulting text item.

Related Functions

  • FROMDATETIME
  • NUMBERTOTEXT
  • TEXT
  • TEXTTODATE
  • TEXTTONUMBER
  • TEXTTOTIME
  • TIMETOTEXT
  • TODATETIME

Feedback