strftime_variation23.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Test strftime() function : usage variation - Checking large positive and negative float values to timestamp.
  3. --FILE--
  4. <?php
  5. /* Prototype : string strftime(string format [, int timestamp])
  6. * Description: Format a local time/date according to locale settings
  7. * Source code: ext/date/php_date.c
  8. * Alias to functions:
  9. */
  10. echo "*** Testing strftime() : usage variation ***\n";
  11. // Initialise function arguments not being substituted (if any)
  12. setlocale(LC_ALL, "en_US");
  13. date_default_timezone_set("UTC");
  14. $format = '%b %d %Y %H:%M:%S';
  15. echo "\n-- Testing strftime() function with float 12.3456789000e10 to timestamp --\n";
  16. $timestamp = 12.3456789000e10;
  17. var_dump( strftime($format, $timestamp) );
  18. echo "\n-- Testing strftime() function with float -12.3456789000e10 to timestamp --\n";
  19. $timestamp = -12.3456789000e10;
  20. var_dump( strftime($format, $timestamp) );
  21. ?>
  22. ===DONE===
  23. --EXPECTREGEX--
  24. \*\*\* Testing strftime\(\) : usage variation \*\*\*
  25. -- Testing strftime\(\) function with float 12.3456789000e10 to timestamp --
  26. string\(\d*\)\s"Mar\s(26|11)\s(1935|5882)\s(04|00):(50|30):(16|00)"
  27. -- Testing strftime\(\) function with float -12.3456789000e10 to timestamp --
  28. string\(\d*\)\s"(Oct|Dec)\s(08|13|22)\s(2004|1901|-1943)\s(19|20|23):(09|45|30):(44|52|00)"
  29. ===DONE===