‎2007 Dec 11 10:21 AM
Hi All,
I want to know if there is any function module that gives me the difference between two specified times.
For Ex: Time 1: 12/01/2007 00:01 A.M
Time 2: Time 1 - 180 Seconds. This changes the time, also may even change the Date. (As in above situation, the Time 2 will be 11/30/2007 11:58 P.M)
Could some one please suggest if there is any function module for this case.
Thanks in Advance.
‎2007 Dec 11 10:25 AM
You can use this one: HRVE_GET_TIME_BETWEEN_DATES
This returns the days, months and years.
‎2007 Dec 11 10:30 AM
Sorry, i did not read your post very well.
If you want the seconds, you can use this fm one:
CALL FUNCTION 'CX_SCHED_VIA_OPERATING_TIME'
EXPORTING
i_date_start = w_fecha1
i_time_start = w_hora1
i_date_end = w_fecha2
i_time_end = w_hora2
i_unit = w_medida
IMPORTING
E_DURATION = w_horas
EXCEPTIONS
parameters_not_valid = 1
OTHERS = 2.
You can specified de date and hour and in unit, you can put H and it will return the time in hours. Then you only have to translate the hours to seconds.
‎2007 Dec 11 10:28 AM
Hi,
Use Function Module..
SD_DATETIME_DIFFERENCE
or
SD_CALC_DURATION_FROM_DATETIME
‎2007 Dec 11 10:30 AM
‎2007 Dec 11 12:27 PM
Hi, You can use the following function module to calculate the diffrence between to dates in the unit that you want.
COPF_DETERMINE_DURATION calculates the difference between two dates and time in minutes and hours.
Parameters:
EXPORTING
I_START_DATE "The start date of the time interval
I_START_TIME "The start time of the time interval
I_END_DATE "The end date of the time interval
I_END_TIME "The end time of the time interval
I_UNIT_OF_DURATION "Time unit of the duration if not to be calculated in days.
Value ===== Meaning
' ' ===== Day (default)
D ===== Days
H ===== Hours
MIN ===== Minutes
MON ===== Months
S ===== Seconds
WK ===== Weeks
YR ===== Years
I_FACTORY_CALENDER "A factory calender if not using the Gregorian calender
IMPORTING
E_DURATION "Time difference in unit specified.
Message was edited by:
Rajesh Soman