July 2, 201510 yr I thought this issues was going to be simple, but it turns out woking with time is something I've not been able to wrap my head around. Can someone please tell me what is wrong with doing this. If ( Get ( CurrentTime ) > "12:00:00 AM"; If ( Get ( CurrentTime ) < "03:00:00 AM" ; "TRUE" ; "FALSE" ) ; "FALSE" ) What I'm trying to do is find out if the the current time falls between two different times in the day. I want to know if the current time is between 12am and 2:59 AM and return a True or False statement..
July 2, 201510 yr want to know if the current time is between 12am and 2:59 AM and return a True or False statement.. Use Time() to construct a value that you can safely compare to Get ( CurrentTime ): Get ( CurrentTime ) > Time ( 0 ; 0 ; 0 ) and Get ( CurrentTime ) < Time ( 3 ; 0 ; 0 ) is True or False; no need to use If(). Note also that "True" and False" is merely text; the keywords True and False are written without quotes.
July 2, 201510 yr "12:00:00 AM" and "03:00:00 AM" aren't times, but strings.Use Time ( 12 ; 0 ; 0 ) and Time ( 3 ; 0 ; 0 ) instead.
July 2, 201510 yr Author Use Time() to construct a value that you can safely compare to Get ( CurrentTime ): Get ( CurrentTime ) > Time ( 0 ; 0 ; 0 ) and Get ( CurrentTime ) < Time ( 3 ; 0 ; 0 ) is True or False; no need to use If(). How does it know the difference between AM an PM? Are we to use the 24 hour clock if needed. Thanks for the help..
July 2, 201510 yr I want to know if the current time is between 12am and 2:59 AM and return a True or False statement.. Well, if the exact midnight can be included in the range, then you could simplify your test to: Get ( CurrentTime ) < Time ( 3 ; 0 ; 0 ) or, if you prefer: Get ( CurrentTime ) < 10800 as the current time will never be negative. Edited July 2, 201510 yr by comment
Create an account or sign in to comment