bug48097.phpt 811 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Bug #48097 (date_timezone_set function produces wrong datetime result)
  3. --INI--
  4. date.timezone=UTC
  5. --FILE--
  6. <?php
  7. $d = date_create( "Sun, 22 May 1955 02:00:00 +0200" );
  8. var_dump( $d );
  9. echo $d->format( DATE_ISO8601 ), "\n";
  10. echo $d->format( 'U' ), "\n\n";
  11. $d->setTimeZone( new DateTimeZone( 'Europe/Budapest' ) );
  12. var_dump( $d );
  13. echo $d->format( DATE_ISO8601 ), "\n\n";
  14. echo $d->format( 'U' ), "\n\n";
  15. ?>
  16. --EXPECT--
  17. object(DateTime)#1 (3) {
  18. ["date"]=>
  19. string(26) "1955-05-22 02:00:00.000000"
  20. ["timezone_type"]=>
  21. int(1)
  22. ["timezone"]=>
  23. string(6) "+02:00"
  24. }
  25. 1955-05-22T02:00:00+0200
  26. -461203200
  27. object(DateTime)#1 (3) {
  28. ["date"]=>
  29. string(26) "1955-05-22 01:00:00.000000"
  30. ["timezone_type"]=>
  31. int(3)
  32. ["timezone"]=>
  33. string(15) "Europe/Budapest"
  34. }
  35. 1955-05-22T01:00:00+0100
  36. -461203200