idate_variation5.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --TEST--
  2. Test idate() function : usage variation - Passing supported Time format characters to format argument.
  3. --FILE--
  4. <?php
  5. /* Prototype : int idate(string format [, int timestamp])
  6. * Description: Format a local time/date as integer
  7. * Source code: ext/date/php_date.c
  8. * Alias to functions:
  9. */
  10. echo "*** Testing idate() : usage variation ***\n";
  11. // Initialise function arguments not being substituted (if any)
  12. date_default_timezone_set("Asia/Calcutta");
  13. //array of values to iterate over
  14. $inputs = array(
  15. 'Internet Time' => 'B',
  16. '12 hour format' => 'h',
  17. '24 hour format' => 'H',
  18. 'Minutes' => 'i',
  19. 'DST Activated' => 'I',
  20. 'Seconds' => 's',
  21. 'Seconds since Unix Epoch' => 'U',
  22. 'Time zone offset' => 'Z'
  23. );
  24. // loop through each element of the array for timestamp
  25. foreach($inputs as $key =>$value) {
  26. echo "\n--$key--\n";
  27. var_dump( idate($value) );
  28. };
  29. ?>
  30. ===DONE===
  31. --EXPECTF--
  32. *** Testing idate() : usage variation ***
  33. --Internet Time--
  34. int(%d)
  35. --12 hour format--
  36. int(%d)
  37. --24 hour format--
  38. int(%d)
  39. --Minutes--
  40. int(%d)
  41. --DST Activated--
  42. int(%d)
  43. --Seconds--
  44. int(%d)
  45. --Seconds since Unix Epoch--
  46. int(%d)
  47. --Time zone offset--
  48. int(%d)
  49. ===DONE===