HANA SQL DATE Functions – 1

light111Few HANA SQL Date Functions 

In recent work get to know few HANA SQL Script Date Functions and they are really cool.  In many instances we need to convert the date format like- YYYY-MM-DD to the DB date format YYYYMMDD and vice versa. Similarly to add few days to a date, find the number of difference between two days … 

The post shows some date functions that i used in my development work but there are many on them available and will try to post them in my future posts.

Below is the class and method implementation.


Test program that calls the AMDP procedure method.


Debug moment- start of the method.


  • TO_DATS ( )   –  Converts date in the format->   YYYY-MM-DD   to  YYYYMMDD


  • TO_DATE ( )   –  Converts date in the format->     YYYYMMDD to YYYY-MM-DD


  • ADD_DAYS ( )   –  Adds number of days to the date with format YYYY-MM-DD


  • DAYS_BETWEEN( )   –  Gives difference between the start date and end date where date in format – YYYY-MM-DD



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s