strftime_variation13.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. --TEST--
  2. Test strftime() function : usage variation - Checking date related formats which are not supported on Windows.
  3. --SKIPIF--
  4. <?php
  5. if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
  6. die("skip Test is valid for Windows");
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. /* Prototype : string strftime(string format [, int timestamp])
  12. * Description: Format a local time/date according to locale settings
  13. * Source code: ext/date/php_date.c
  14. * Alias to functions:
  15. */
  16. echo "*** Testing strftime() : usage variation ***\n";
  17. // Initialise function arguments not being substituted (if any)
  18. setlocale(LC_ALL, "en_US");
  19. date_default_timezone_set("Asia/Calcutta");
  20. $timestamp = mktime(8, 8, 8, 8, 8, 2008);
  21. //array of values to iterate over
  22. $inputs = array(
  23. 'Century number' => "%C",
  24. 'Month Date Year' => "%D",
  25. 'Year with century' => "%G",
  26. 'Year without century' => "%g",
  27. );
  28. // loop through each element of the array for timestamp
  29. foreach($inputs as $key =>$value) {
  30. echo "\n--$key--\n";
  31. var_dump( strftime($value) );
  32. var_dump( strftime($value, $timestamp) );
  33. }
  34. ?>
  35. ===DONE===
  36. --EXPECTF--
  37. *** Testing strftime() : usage variation ***
  38. --Century number--
  39. bool(false)
  40. bool(false)
  41. --Month Date Year--
  42. bool(false)
  43. bool(false)
  44. --Year with century--
  45. bool(false)
  46. bool(false)
  47. --Year without century--
  48. bool(false)
  49. bool(false)
  50. ===DONE===