I searched the PHP manual and StackOverflow too, but haven't really found a proper answer to my question. My dates are stored in UTC. Now if I do:
$date = new DateTime('2012-03-16 14:00:00', 'UTC');
$date->setTimezone('Europe/Budapest');
Will DateTime::setTimezone() set DST automatically? So if I format the string, will it output 15:00:00 in summer time and 16:00:00 in winter time? Or will I have to set DST manually?
Related question, if I want to get a DST independent UTC time (that I can store), will the following work?
$date = new DateTime('now', 'UTC');
$date->format('Y-m-d H:i:s');
Or better to use simple gmdate('Y-m-d H:i:s')
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…