Jump to content
Server Maintenance This Week. ×

Calculation based to time


Devin

This topic is 3227 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

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

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

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 by comment
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.