Reputation: 77
I have a loop which runs in php..
I only want the loop to run if the local (sydney, australia) time is between 1pm and 3pm.
Can anyone provide an example of how this would function? Thank you!
Upvotes: 3
Views: 376
Reputation: 1916
you can use cron if you want to autorun some scripts at some time...
crontab -e
then add your script to be executed as following:
* * * * * /path/to/script
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
Upvotes: 6
Reputation: 33697
Put
if (date('H') == 13 || date('H') == 14)
above the loop.
(Given that your webserver is set to your local time.)
Upvotes: 0