DateTime_extends_basic3.phpt 562 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. Test DateTime class inheritance : with user space fromat() method
  3. --FILE--
  4. <?php
  5. //Set the default time zone
  6. date_default_timezone_set("Europe/London");
  7. echo "*** Testing new DateTime() : with user format() method ***\n";
  8. class DateTimeExt extends DateTime
  9. {
  10. public function format($format = "F j, Y, g:i:s a")
  11. {
  12. return parent::format($format);
  13. }
  14. }
  15. $d = new DateTimeExt("1967-05-01 22:30:41");
  16. echo $d->format() . "\n";
  17. ?>
  18. ===DONE===
  19. --EXPECTF--
  20. *** Testing new DateTime() : with user format() method ***
  21. May 1, 1967, 10:30:41 pm
  22. ===DONE===