cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module to add two hours to a timestamp

Former Member
0 Likes
3,352

Hi Gurus,

In BSP application, we need to show users the time of business process trigger. But, that time is as per application server. After fetching that timestamp, we need to add two hours in it to convert it to CET. For e.g. the process triggered at 23:00:00 on 22 July 2008 should automatically convert to 01:00:00 and date 23/07/2008. Please give me pointer if there is any such function module where i can give offset and get my time converted. This should also take care of leap year, months with 31 days and so on.

Thanks and Regards,

Harpal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi,

Just a hint...try looking in the ABAP general forum...you might fine some more help there...as this is an ABAP related issue...

Cheers,

Tatvagna.

Answers (2)

Answers (2)

Former Member
0 Likes

I found one function module named C14B_ADD_TIME. The code for which is

FUNCTION C14B_ADD_TIME.

*"----


""Lokale Schnittstelle:

*" IMPORTING

*" VALUE(I_STARTTIME) TYPE T

*" VALUE(I_STARTDATE) TYPE D

*" VALUE(I_ADDTIME) TYPE T

*" EXPORTING

*" VALUE(E_ENDTIME) TYPE T

*" VALUE(E_ENDDATE) TYPE D

*"----


DATA : DIFFERENZ TYPE I.

E_ENDTIME = I_STARTTIME + I_ADDTIME.

DIFFERENZ = E_ENDTIME - I_STARTTIME.

IF DIFFERENZ < 0.

E_ENDDATE = I_STARTDATE + 1.

ELSE.

E_ENDDATE = I_STARTDATE.

ENDIF.

ENDFUNCTION.

Thanks and Regards,

Harpal

BGarcia
Active Contributor
0 Likes

Hi Harpal,

Take a look into class CL_ABAP_TSTMP.

It was some static methods that allow you to add,subtract seconds in a timestamp, just like you want.

Kind regards.