FROMDATETIME
The FROMDATETIME function converts a date/time item to a text string of a specified format. For example, you can use FROMDATETIME to convert a date-time item into a string for parsing or concatenation. You can also use this function to access the individual parts of a date or time, such as the month, day, year, and so forth.
- Syntax:
FROMDATETIME (single-character-date-time-item
[ , single-text-expression ] )- Meaning:
- FROMDATETIME (date_time [ , date_time_format_string ] )
- Returns:
- A single character text item
FROMDATETIME returns the date/time specified by date_time as a text item with the format specified by date_time_format_string. If date_time_format_string is not specified, date_time will be returned in the same format as the date_time.
The date_time_format_string must conform to the date/time format strings as described in the "Format strings" topic.
Examples
- HeaderLine="Today is" + FROMDATETIME (CURRENTDATE (),"{MON
DD, CCYY}")
If the current system date is March 3, 1999, this rule evaluates to Today is Mar 03, 1999.
- FROMDATETIME ( TransactionTimeStamp
Column:.:TransHistory )
If the value of TransactionTimeStamp Column is 10:14 A.M. on February 3, 2000 and its format is defined as "{CCYYMMDDHH24MM}", this rule evaluates to 200002031014.
- EXTRACT (Expense:Report, FROMDATETIME (Date:Expense:Report,
"{MM}" ) = "03")
In this example, the FROMDATETIME function is used in the condition expression of the EXTRACT function to identify all expenses in the month of March.
Related functions
- CURRENTDATE
- CURRENTDATETIME
- CURRENTTIME
- DATETOTEXT
- TODATETIME