xref: /PHP-7.1/ext/date/tests/bug52342.phpt (revision 7af945e2)
1--TEST--
2Bug #52342 (DateTime setIsoDate results in wrong timestamp)
3--FILE--
4<?php
5date_default_timezone_set('Europe/Berlin');
6$from = new DateTime();
7$from->setTime(0, 0, 0);
8$from->setISODate(2010, 28, 1); //Montag der 28ten Woche 2010
9
10echo $from->format('d.m.Y H:i'), "\n"; //A
11echo $from->getTimestamp(), "\n"; //B
12echo date('d.m.Y H:i', $from->getTimestamp()), "\n"; //C
13
14$from->add(new DateInterval('P0D'));
15echo $from->getTimestamp(), "\n"; //B
16echo date('d.m.Y H:i', $from->getTimestamp()), "\n"; //C
17?>
18--EXPECT--
1912.07.2010 00:00
201278885600
2112.07.2010 00:00
221278885600
2312.07.2010 00:00
24