gmdate_variation11.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Test gmdate() function : usage variation - Passing Full Date/Time format options to format argument.
  3. --FILE--
  4. <?php
  5. echo "*** Testing gmdate() : usage variation ***\n";
  6. // Initialise all required variables
  7. date_default_timezone_set('UTC');
  8. $timestamp = mktime(8, 8, 8, 8, 8, 2008);
  9. echo "\n-- Testing gmdate() function with ISO 8601 date format --\n";
  10. var_dump( gmdate('c') );
  11. var_dump( gmdate('c', $timestamp) );
  12. echo "\n-- Testing gmdate() function with RFC 2822 date format --\n";
  13. var_dump( gmdate('r') );
  14. var_dump( gmdate('r', $timestamp) );
  15. echo "\n-- Testing gmdate() function with seconds since Unix Epoch format --\n";
  16. var_dump( gmdate('U') );
  17. var_dump( gmdate('U', $timestamp) );
  18. ?>
  19. --EXPECTF--
  20. *** Testing gmdate() : usage variation ***
  21. -- Testing gmdate() function with ISO 8601 date format --
  22. string(%d) "%s"
  23. string(25) "2008-08-08T08:08:08+00:00"
  24. -- Testing gmdate() function with RFC 2822 date format --
  25. string(%d) "%s"
  26. string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
  27. -- Testing gmdate() function with seconds since Unix Epoch format --
  28. string(%d) "%d"
  29. string(10) "1218182888"