Given the schedule:
{
"start_day": "Monday",
"end_day": "Friday",
"start_time": "9:00 AM",
"end_time": "6:00 PM"
}
How can I determine if the current time in a specified time zone falls within the above given schedule? Are there any functions in PHP that'll help me? Issues that I foresee:
- Dealing with time zones
- The given schedule doesn't provide year information, but I guess I can assume it applies to the current year
- Dealing with the range of days (Monday and Friday are provided; how do I know that there are Tuesday, Wednesday, and Thursday in between?
UPDATE 1:
Change JSON so it encompasses all days/times:
{
"start_day": "Monday",
"end_day": "Sunday",
"start_time": "12:00 AM",
"end_time": "11:59 PM"
}
Then change $now
assignment to $now = new DateTime("Saturday next month 10 am", $timezone);
Nothing is outputted.