idate_variation6.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Test idate() function : usage variation - Checking return of year(1 or 2 digits) format starting with zero and nonzero.
  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. $format = 'y';
  14. echo "\n-- Testing idate() function for 2 digit year having no zero as starting number --\n";
  15. $timestamp = mktime(8, 8, 8, 8, 8, 1970);
  16. var_dump( idate($format, $timestamp) );
  17. echo "\n-- Testing idate() function for 2 digit year having zero as starting number --\n";
  18. $timestamp = mktime(8, 8, 8, 8, 8, 2001);
  19. var_dump( idate($format, $timestamp) );
  20. ?>
  21. ===DONE===
  22. --EXPECTF--
  23. *** Testing idate() : usage variation ***
  24. -- Testing idate() function for 2 digit year having no zero as starting number --
  25. int(70)
  26. -- Testing idate() function for 2 digit year having zero as starting number --
  27. int(1)
  28. ===DONE===