gmdate_variation11.phpt 1.3 KB

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