calendar_fieldDifference_basic.phpt 827 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. IntlCalendar::fieldDifference() basic test
  3. --INI--
  4. date.timezone=Atlantic/Azores
  5. --SKIPIF--
  6. <?php
  7. if (!extension_loaded('intl'))
  8. die('skip intl extension not enabled');
  9. --FILE--
  10. <?php
  11. ini_set("intl.error_level", E_WARNING);
  12. ini_set("intl.default_locale", "nl");
  13. $intlcal = IntlCalendar::createInstance('UTC');
  14. $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);
  15. var_dump(
  16. $intlcal->fieldDifference(
  17. strtotime('2012-02-29 06:06:08 +0000') * 1000,
  18. IntlCalendar::FIELD_SECOND),
  19. $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY));
  20. $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);
  21. var_dump(
  22. intlcal_field_difference(
  23. $intlcal,
  24. strtotime('2012-02-29 06:07:08 +0000') * 1000,
  25. IntlCalendar::FIELD_MINUTE));
  26. ?>
  27. ==DONE==
  28. --EXPECT--
  29. int(3601)
  30. int(6)
  31. int(61)
  32. ==DONE==