I have a card expiry info passed to me as:
$date = '2014-12-22';
$hour = '19';
$minute = '30';
and I need to figure out if access can be granted based on the door location's current date and time each of which is in different timezone. The script that checks this is generated hourly and distributed to access servers which needs to deduce if the door's local time is before the expiry time (the whole design is rather convoluted and rather poorly designed).
I need to compare the bellow $door_datetime to the card expiry info (date, hour, minute)
$door_datetime = new DateTime;
$door_datetime->setTimezone(new DateTimeZone($door_timezone));
An added issue is that the db data is not being actively cleaned up and there are millions of card expiry date, hour, minute to compare to the $door_datetime; and as you can imagine at busy time that becomes an issue as the server slows down.
Any ideas on how to efficiently find out if the $door_datetime is before or after the $date, $hour, $time?