Thursday, March 14, 2019

Use EXTRACT Function in a Formula



EXTRACT
Function extracts a value from a date or interval value.

Syntax for a constant value:
EXTRACT (<Date_Part> from DATE 'Year-Month-Day')

Syntax for a Date field:
EXTRACT (<Date_Part> from {fieldID})

Examples:

1. EXTRACT (Month from DATE '2013-07-23')
   > Result: 7

2. EXTRACT (Day from {today})
   > Result: Today's date, e.g. 28 

3. CASE WHEN (EXTRACT (YEAR from DATE '2014-09-29')) = 2014 THEN 1 ELSE 0 END
   > Returns 1 for the CASE condition

No comments:

Post a Comment