2011 Feb 28 9:44 AM
HI,
I have a requirement where i need to find the timestamp difference and then convert it to 9 hours format. This mean instead of 24hrs a day, i need to consider only 9hrs (working hours only) a day.
I thought of calculating first as 24hours format using Function Module /SDF/CMO_DATETIME_DIFFERENCE (Output for this is number of days and hours), then multiply the result with number 9. Somehow i feel this is not correct as we can get hours result as 17/20/23hrs. when this hours i divide by 9hrs, probably i might get 2 days. which is not correct.
Please help me to resolve this issue. Thank you in advance.
Thansk,
Deepika
2011 Mar 01 11:36 AM
You have to calculate the proportional value.
if 9 hours is considered 100% then the difference you calculated is X, so X = diference * 100 / 9, this way you will have a percentage of a 9 hour day. Then it's the same but with 24, so if 24 is 100% then X hours is percentage you calculated before.
X = 24 * percentage / 100 and you will get the hours proportional to a 24 hour day.
Hope i was clear enough
2011 Mar 01 11:28 AM
2011 Mar 01 11:36 AM
You have to calculate the proportional value.
if 9 hours is considered 100% then the difference you calculated is X, so X = diference * 100 / 9, this way you will have a percentage of a 9 hour day. Then it's the same but with 24, so if 24 is 100% then X hours is percentage you calculated before.
X = 24 * percentage / 100 and you will get the hours proportional to a 24 hour day.
Hope i was clear enough
2011 Mar 02 4:20 AM
Hi Pedro,
Thank you for your reply. But,
I donot want to calculate in terms of percentage. Need to find out difference in 9hours a day instead of 24hrs a day.
Hi Satish,
I need to find the difference of 2 timestamps and convert that to 9 hours a day. For example
Start time stamp = 22/02/2011 13:00:00
End timestamp = 23/02/2011 13:00:00
difference is 24hrs/ 1 day
So final difference is 1 * 9hrs = 9hrs.
Hope this helped you.
Thanks,
Deepika
2011 Mar 02 9:48 AM
Hi, I am not sure whether my understanding is right. Please check.
As you have mentioned, if you can use the same function module to find the days and time difference,
For instance:
Date1 is 01.03.2011
Time1 is 13:00:00
Date2 is 02.03.2011
Time2 is 21:00:00
The output of the function module is 1 days and 8 hrs. Convert this to day format. You'll get 1.33 days. Multiply this with your required 9 hrs which in turn will give you 11.97 working hours. Is this is what you are looking for?
2011 Mar 03 3:50 AM
Hi Mahalingam,
You are correct. This way it will help me get to 9 hours a day. Thank you very much.
Points are awarded.
Thanks,
deepika