I’m looking at PHP date() documentation and thought that 'I' would tell me whether the date supplied was in DST. So I expected the following:
$d = strtotime('2012-07-01 12:30:00, Europe/London'); // this is in DST
$bool = date('I',$d); // 1
but got this:
$bool = date('I',$d); // 0
Obviously I’m reading the documentation wrong. I know I can do this using dateTimeZone() transitions, but is this not a feature of date() as well?
When you do
strtotimeyou get an integer. You have lost all information of timezone, DST etc, you just get an integer. See http://php.net/manual/en/function.strtotime.phpIf you want to work with that kind of information, you should use the
DateTimeclass and functions: http://php.net/manual/en/class.datetime.phpYou could, but I think you’re better off using
DateTime, set the current timezone to wherever you wish information from:(from the
date()manual, example 1: http://www.php.net/manual/en/function.date.php )