2008 Nov 25 11:25 AM
Hello experts ,
I want to know how i can subtract hours from current time ( sy-uzeit )
What is the name of function that implement this task ?
For example : if current time is 1:30:00 ,
And i want subtract 3 hours , the result will be 22:30:00.
Thanks for the help .
2008 Nov 25 11:40 AM
Hello,
This is a small ABAP program that will help you.
The subtraction is always calculated in seconds.
report ztest.
* This report will subtract 3 hours from the current time.
data: w_time like sy-uzeit.
data: w_seconds type i.
w_seconds = 3 * 3600.
w_time = sy-uzeit - w_seconds.
write: / w_time.
Wim
Hello experts ,
I want to know how i can subtract hours from current time ( sy-uzeit )
What is the name of function that implement this task ?
For example : if current time is 1:30:00 ,
And i want subtract 3 hours , the result will be 22:30:00.
Thanks for the help .
2008 Nov 25 11:29 AM
hi
please refer to this link
hope this helps
regards
Aakash Banga
2008 Nov 25 11:38 AM
Hello ,
Thanks for the help but this link was not give me answer on my question.
2008 Nov 25 11:41 AM
Hello Avi,
Please check "TIMECALC_MOVE" FM. Here you have to pass '-' to the IMPORT param DIRECTION.
As you are subtracting the time.
BR,
Suhas
2008 Nov 25 11:38 AM
hi
declare a local variable W_UZEIT type SY_UZEIT.
and write the code
w_uzeit = sy-uzeit - 10800.
When we subtract 3hrs from SY_UZEIT it will subtract 10800 seconds from the system time (SY_UZEIT gives system time ).This is equivalent to subtracting 3 hrs.
Here we are not modifying SY-UZEIT... instead we are declaring a variable W_UZEIT and assigning the subtracted value.
regards
Satish
2008 Nov 25 11:38 AM
Hi,
Try Using the FM SD_CALC_DURATION_FROM_DATETIME
Hope it helps u out.
Thanks & Regards
2008 Nov 25 11:46 AM
Hello,
This FM give difference ( in hour ) between 2 elements of date and time.
This FM was not help me , thanks.
2008 Nov 25 11:52 AM
Hello,
Did you check the little ABAP program I posted, it will always work.
Wim
2008 Nov 25 11:40 AM
2008 Nov 25 11:40 AM
Hello,
This is a small ABAP program that will help you.
The subtraction is always calculated in seconds.
report ztest.
* This report will subtract 3 hours from the current time.
data: w_time like sy-uzeit.
data: w_seconds type i.
w_seconds = 3 * 3600.
w_time = sy-uzeit - w_seconds.
write: / w_time.
Wim