Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Time difference between two date and time

Hi All,

I have an urgent requirement to calculate days,hours,minutes and seconds between first creation order (date and time), and confirmed creation order (Date and time.)

E.g Begin Date 02.01.2008 Begin Time 11:12:23

End Date 08.01.2008 End Time 12:12:28

Now i have to find days,hours,minutes and seconds between The Begin Data(date and Time)

and End Data(date and Time).

Please let me know if there is any FM which could help me or any other way to solve this issue.

All helpful ans will be immediately rewarded

Thanks

Vijay

Tags:
Former Member replied

Hi,

you can use the FM SALP_SM_CALC_TIME_DIFFERENCE to get the difference in seconds.

To calculate the days, hours, etc you can use the DIV and MOD function like this:

days = seconds DIV 86400.

rest = seconds MOD 86400.

hours = rest DIV 3600.

rest = rest MOD 3600.

minutes = rest DIV 60.

seconds = rest mod 60.

Kindly Regards,

Stefan

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question