I want to have code in a loop that only runs if it is before 5pm on any day.
What code would do this?
IF (current_time < 5:00pm) {
// Do stuff
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simple one that gets the job done:
Just remember that this date comes from the server. So, if the client is in another timezone, that may not work as required. The good thing about this, is that the user can’t change his computer date in order to trick the site into something.
And if you want to do that with javascript (where the value will come from the user’s computer), just do the following: