Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

(20.12.2006 at 04:30 pm) - (18.12.2006 at 10:30 am) = how many hours.

Former Member
0 Kudos

Hello All,

can any give me logic for

(20.12.2006 at 04:30 pm) - (18.12.2006 at 10:30 am) = "how many hours".

If i want to subtract 18.12.2006 at 10:30 am. from 20.12.2006 at 04:30 pm. then i want to calculate how many hours.

or

sy-datum - (18.12.2006 at 10:30 am) = "in hours"

how to do this i want logic with example. can any give solution of this problem.

Regards.

Rajesh.

10 REPLIES 10

athavanraja
Active Contributor
0 Kudos

SD_DATETIME_DIFFERENCE

0 Kudos

Hi

Use the following FM:

SALP_SM_CALC_TIME_DIFFERENCE

it gives the difference in seconds and you devide the same by 3600

the you get the difference time

Thanks

Shiva

0 Kudos

Hi,

U can this one also :

L_MC_TIME_DIFFERENCE

this gives the time difference in Minutes.

you devide the MInutes by 60 then you will get the desired output

Thanks

Shiva

Former Member
0 Kudos

Do this way.

if 'pm'.

V1 = 12 + 4:30

elseif 'am'.

V1 = 4:30

endif.

date = 20.12.2006 - 18.12.2006

V3 = date * 24.

if 'pm'.

V4 = 10:30

V5 = V3 - V4 + V1.

***********************

else use SD_DATETIME_DIFFERENCE.

Message was edited by:

Ramesh Babu Chirumamilla

Former Member
0 Kudos

Hi

Please check FM

<b>SD_CALC_DURATION_FROM_DATETIME</b>

Former Member
0 Kudos

use this function module

/SDF/CMO_DATETIME_DIFFERENCE pass both times and dates and get the differnce

Former Member
0 Kudos

hey use this function module u will get time in seconds then convert to minutes or hours

SALP_SM_CALC_TIME_DIFFERENCE

Reward points if useful

Regards,

Sree

Former Member
0 Kudos

Hi

use the following function module.

SD_CALC_DURATION_FROM_DATETIME

gives you the time in hours.

Regards

Abdullah

Message was edited by:

Abdullah Ismail

Former Member
0 Kudos

u can use the Fm

L_MC_TIME_DIFFERENCE

and divide the minutes my 60 to get the hrs.

regards,

vijay

Former Member
0 Kudos

Hi,

You can use this function module TIMECALC_DIFF.

The TimeZone that you want in this fuction can be selected from table TTZZ according to your need.

Thanks,

Sutapa.