gmdate_variation10.phpt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. --TEST--
  2. Test gmdate() function : usage variation - Passing Timezone 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('Asia/Calcutta');
  13. $timestamp = mktime(8, 8, 8, 8, 8, 2008);
  14. echo "\n-- Testing gmdate() function with Timezone identifier format --\n";
  15. var_dump( gmdate('e') );
  16. var_dump( gmdate('e', $timestamp) );
  17. echo "\n-- Testing gmdate() function with checking whether date is in daylight saving time format --\n";
  18. var_dump( gmdate('I') );
  19. var_dump( gmdate('I', $timestamp) );
  20. echo "\n-- Testing gmdate() function with difference to GMT in hours format --\n";
  21. var_dump( gmdate('O') );
  22. var_dump( gmdate('O', $timestamp) );
  23. echo "\n-- Testing gmdate() function with Difference to GMT in hours using colon as separator format --\n";
  24. var_dump( gmdate('P') );
  25. var_dump( gmdate('P', $timestamp) );
  26. echo "\n-- Testing gmdate() function with timezone abbreviation format --\n";
  27. var_dump( gmdate('T') );
  28. var_dump( gmdate('T', $timestamp) );
  29. echo "\n-- Testing gmdate() function with timezone offset format --\n";
  30. var_dump( gmdate('T') );
  31. var_dump( gmdate('T', $timestamp) );
  32. ?>
  33. ===DONE===
  34. --EXPECTF--
  35. *** Testing gmdate() : usage variation ***
  36. -- Testing gmdate() function with Timezone identifier format --
  37. string(3) "UTC"
  38. string(3) "UTC"
  39. -- Testing gmdate() function with checking whether date is in daylight saving time format --
  40. string(1) "%d"
  41. string(1) "%d"
  42. -- Testing gmdate() function with difference to GMT in hours format --
  43. string(5) "+0000"
  44. string(5) "+0000"
  45. -- Testing gmdate() function with Difference to GMT in hours using colon as separator format --
  46. string(6) "+00:00"
  47. string(6) "+00:00"
  48. -- Testing gmdate() function with timezone abbreviation format --
  49. string(3) "GMT"
  50. string(3) "GMT"
  51. -- Testing gmdate() function with timezone offset format --
  52. string(3) "GMT"
  53. string(3) "GMT"
  54. ===DONE===