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: 

Adding hours to time gives a new date

Former Member
0 Kudos

Hello,

Can anyone tell me if there is a FM for following example:

Date = 12.12.2008

Time = 19:00:00

I want to add 8 hours to the "Time". The new date and time then should be 13.12.2008 03:00:00.

I've search the forum for some hours but couldn't find a similar example.

Kind rgds,

Patrick

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor

you can use this FM: C14B_ADD_TIME

4 REPLIES 4

Former Member
0 Kudos

HI Keltjens,

I dont think you need a FM to do this.

You can directly add 8 Hrs to the time variable. Check if the value is greater than 24:00:00.

If yes, then ADD ONE to your date field and subtract the time variable form 24 to get the correct time as well.

E.G.

Date = 12/12/2008

Time = 19:00:00

Time = 19:00:00 + 08:00:00 = 27:00:00.

IF Time > 24:00:00.

Increment date here.

Subtract time from 24:00:00.

ENDIF.

Hope this helps:)

Best Regards,

Ram.

Former Member
0 Kudos

SE37 enter datetime* and then F4.

Former Member
0 Kudos

Hi,

Use FM C14Z_CALC_DATE_TIME.

[Check This Also....|;

Thanks

Nitesh

JozsefSzikszai
Active Contributor

you can use this FM: C14B_ADD_TIME