If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

average date

Started by pooja, 19 Jan 2010 09:51:10 PM

Previous topic - Next topic

pooja

I have posted couple of issues related with dates.I am looking to way out for this calculation--
I have calculated timestamp diff and come up this kind o results

example----
123 days 28 hrs 45min 10sec

now I trying to change this into decimal, ex 123.17 days

Please need advice/suggestion/solution kindly appreciated.

thank you in advance

blom0344

From an earlier post I suggested a solution that would give you the difference as an integer value. If that approach works then it would be just a matter of performing a division by a fixed constant to get that number of days like  123.17

example:

_round((extract(day;current_timestamp  - _make_timestamp (2010;01;18))*24*3600+
extract(hour;current_timestamp  - _make_timestamp (2010;01;18))*3600+
extract(minute;current_timestamp  - _make_timestamp (2010;01;18))*60+
extract(minute;current_timestamp  - _make_timestamp (2010;01;18)))/86400;4)

In this example current time is compared with a generated timestamp (earliest second on 2010-01-18)
According to my output this generates the exact difference in days