DateTime_construct_basic1.phpt 1008 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --TEST--
  2. Test new DateTime() : basic functionality
  3. --FILE--
  4. <?php
  5. //Set the default time zone
  6. date_default_timezone_set("Europe/London");
  7. echo "*** Testing new DateTime() : basic functionality ***\n";
  8. var_dump( new DateTime('') );
  9. var_dump( new DateTime("GMT") );
  10. var_dump( new DateTime("2005-07-14 22:30:41") );
  11. var_dump( new DateTime("2005-07-14 22:30:41 GMT") );
  12. ?>
  13. --EXPECTF--
  14. *** Testing new DateTime() : basic functionality ***
  15. object(DateTime)#%d (3) {
  16. ["date"]=>
  17. string(%d) "%s"
  18. ["timezone_type"]=>
  19. int(3)
  20. ["timezone"]=>
  21. string(13) "Europe/London"
  22. }
  23. object(DateTime)#%d (3) {
  24. ["date"]=>
  25. string(%d) "%s"
  26. ["timezone_type"]=>
  27. int(2)
  28. ["timezone"]=>
  29. string(3) "GMT"
  30. }
  31. object(DateTime)#%d (3) {
  32. ["date"]=>
  33. string(26) "2005-07-14 22:30:41.000000"
  34. ["timezone_type"]=>
  35. int(3)
  36. ["timezone"]=>
  37. string(13) "Europe/London"
  38. }
  39. object(DateTime)#%d (3) {
  40. ["date"]=>
  41. string(26) "2005-07-14 22:30:41.000000"
  42. ["timezone_type"]=>
  43. int(2)
  44. ["timezone"]=>
  45. string(3) "GMT"
  46. }