01-12-2005 5:43 AM
Hai,
Thanks for your kind assistance.
I want to check whether Current time
is between 16:00 and 21:00
do we have any Function?
Regards
Chandra kumar.
01-12-2005 6:59 AM
Hi dear chandra kumar,
One can use this logic :
*----
report abc.
data : t1 type sy-uzeit,
t2 type sy-uzeit.
t1 = '1600'.
t2 = '2100'.
write 😕 sy-uzeit.
if sy-uzeit >= t1 and sy-uzeit <= t2.
write : 'current time is in between ' , t1 , 'and' , t2.
else.
write : 'current time is NOT in between ' , t1 , 'and' , t2.
endif.
*----
I have opened my account in sdn for the first
time today and this is my first reply to you.
I Hope your purpose is solved.
Please give point if u feel satisfied.
Thanks & Regards,
Amit Mittal.
01-12-2005 6:59 AM
Hi dear chandra kumar,
One can use this logic :
*----
report abc.
data : t1 type sy-uzeit,
t2 type sy-uzeit.
t1 = '1600'.
t2 = '2100'.
write 😕 sy-uzeit.
if sy-uzeit >= t1 and sy-uzeit <= t2.
write : 'current time is in between ' , t1 , 'and' , t2.
else.
write : 'current time is NOT in between ' , t1 , 'and' , t2.
endif.
*----
I have opened my account in sdn for the first
time today and this is my first reply to you.
I Hope your purpose is solved.
Please give point if u feel satisfied.
Thanks & Regards,
Amit Mittal.
01-12-2005 7:14 AM
Hello Amit,
It's nice to know that we have a new member here at SDN. A hearty welcome to you. Hope to have a lot of discussions where we could share some interesting stuff.
Regards,
Anand Mandalika.
01-12-2005 7:02 AM
01-12-2005 7:26 AM
Hello Chandra,
There's a small point that I would like to make. Though it is a good idea to use the exisitng Function Modules to meet our requirements, it is not very wise to always spend much time in searching for a Function Module in cases as simple as this one.
There are several ways in which you can check for the condition you want- The following is one of them...
if sy-uzeit between '080000' and '210000'.
* Do the processing.
endif.
Regards,
Anand Mandalika.
11-11-2008 10:02 PM
This logic does not work if the time interval goes across midnight.
For example, lets say I want to check whether 02:00:00 is between 22:00:00 and 04:00:00.
Does anybody have a more robust logic for doing time comparison?
11-11-2008 10:13 PM
You will probably get more response if you open your own thread.
Before you start, you have to know the date of all three times..
Rob