Telling if a given datetime is within the DST switchover
| From: | Larry Martell | Date: | Mon, 30 Mar 2015 15:20:47 +0000 |
| Subject: | Telling if a given datetime is within the DST switchover | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324727@lists.php.net to get a copy of this message | ||
Does anyone have a method or function for telling if a datetime is
within the DST switchover based on the time zone?
For example, if the script were running in England, a datetime of
March 29 2015 01:30 would return True. If it were running in NY, March
8 2015 02:30 would return True. I'm looking for something that would
work for any time zone and for any year.
The use case is that I have a server uptime reporting script and it
uses a database of times that the server was able to be pinged. If
there is no entry for a period it indicated the server was down. So on
March 29, running in London, it found no entries from 1am to 2am and
it reported the server was down for an hour, when in fact the period
from 1am to 2am did not exist because of the switch to summer time.
TIA!
-larry