RelativeDate in SAP Web Intelligence

Recently, I have been given a requirement to convert date time from a standard application server time to users local time with a difference of few hours. Needless to say, I was a looking for a standard function that allows me to perform this calculation in a simplest form ever.

Fortunately Web Intelligence provides a function to allow us to do this, you can look up for RelativeDate() function.

This function requires two values, first value is the date field that you wish to manipulate (add/subtract) from and the second value is the number of hours/days that you want to add or subtract from the date field.

Capture

In this example, you can see that the second value shows -0.2083333333333333. Basically, I’m subtracting 5 hours from the first value. You can actually calculate the hours that you want to add/subtract by a simple formula using Hours/24. So 5/24 equals to 0.2083333333333333 which explains how I get this figure as below.

09jan2016

This comes in pretty handy if you have a similar requirement. Hope it helps!

Leave a comment