SAP HANA - Useful formulas for Date / Time / Month / Day / Year in Calculation View

Hi,

There is a function to extract desired parts from DATE and TIME.

Function name:

  • component

Syntax:

  • component(date, desired_value )

Usage:
  • Value for desired_value argument may be int the range 1..6, the values mean year, month, day, hour, minute, second, respectively. 
  • If a component is not set in the date, the component function returns a default value, 1 for the month or the day, 0 for other components. 
  • You can also apply the component function to longdate and time types.


Examples :  You can use the below formulas.

  • Today Date:   NOW( )
  • Year from a Date:  COMPONENT ( NOW ( ) , 1 )