Devin Posted July 2, 2015 Share Posted July 2, 2015 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.. Link to comment Share on other sites More sharing options...
eos Posted July 2, 2015 Share Posted July 2, 2015 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. Link to comment Share on other sites More sharing options...
Raybaudi Posted July 2, 2015 Share Posted July 2, 2015 "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. Link to comment Share on other sites More sharing options...
Devin Posted July 2, 2015 Author Share Posted July 2, 2015 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.. Link to comment Share on other sites More sharing options...
eos Posted July 2, 2015 Share Posted July 2, 2015 Are we to use the 24 hour clock if needed. Yes. Link to comment Share on other sites More sharing options...
Devin Posted July 2, 2015 Author Share Posted July 2, 2015 Perfect.. Looks like this is working. Thanks four you help. Link to comment Share on other sites More sharing options...
comment Posted July 2, 2015 Share Posted July 2, 2015 (edited) 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, 2015 by comment Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 3227 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now