Finding Difference between two Dates and use the result as integer / real for other calculation

Question asked by dinesh.narahari on Dec 11, 2015
Latest reply on Dec 15, 2015 by dinesh.narahari

Hi All,

I have a requirement where in i have to prorate a real value based on the no of the days of usage per bill cycle. I am getting below values as input.

1) Volume (integer /real value) - for example : 5000

2) No of Days of Usage (integer /real value) : for example : 20

3) No of Billing Days in Bill Cycle : For this i am not getting a straight value, instead bill cycle start date (date / timestamp) and bill cycle end date ((date / timestamp) is being passed using which i need to find the difference between them and convert it in to real/integer value to use it in the below given calculation

Prorated Volume = ( No of Days of Usage / No of Billing Days ) * Volume

Ex: Prorated Volume = (20/30) * 5000 = 3333.33

The difference ( i.e. No of Billing Days) between two timestamps results in a duration which cannot be type caste to integer or real directly to use it further for calculation.Please let me know if there is a possibility to achieve the above problem as soon as possible.

Thanks

Dinesh