@TextToTime (Formula Language)

Converts a text string to a time-date value, where possible.

Syntax

@TextToTime( string )

Parameters

string

Text or text list. The string you want to convert to a time-date.

Return value

time-date

Time-date, time-date range, or list thereof. The string, converted to a time-date.

Usage

If the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.

This function is useful for converting a date within a text field to a value that can be used for computation in a time-date field.

"Today", "Tomorrow", and "Yesterday" are the only legal strings to use to represent relative dates. The formula @TextToTime("Next week") returns a blank because the text string "Next week" cannot be converted to a time-date value.

@TextToTime returns an error If you try to pass anything besides a string into it, including a time-date value.

Examples

  1. This example returns 123.45.
    @Text(123.45)
  2. This example returns $800.00 if the value in the Sales field is 800.
    @Text(Sales;"C,2")
  3. This example returns 8.00E+02.
    @Text(800;"S")
  4. This example returns 8.00E+02 and -6.00E+02 in a list.
    @Text(800 : (-600);"S")
  5. This example returns 04/11/93 10:43 AM.
    @Text(@Now)
  6. This example returns 04/11.
    @Text(@Now;"D1S0")
  7. This example returns 10:43:30 AM.
    @Text(@Now;"D1S1")
  8. This example returns 04/93 10:43 AM.
    @Text(@Now;"D3T1")
  9. This example returns the rich-text Body field stripped of attachments and formatting.
    @Text(Body)
  10. To convert a number date (in the ShipDate field) into a written date, you can use the following code. If ShipDate contains [08/31/2002], the result is "August 31, 2002."
    @If( @IsTime(ShipDate); 
    @Text(@Select(@Month(ShipDate); "January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November";  "December"))  + " " +
    @Text(@Day(ShipDate)) + ", " + @Text(@Year(ShipDate));
     "No date given")