getdate_basic.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. --TEST--
  2. Test getdate() function : basic functionality
  3. --FILE--
  4. <?php
  5. /* Prototype : array getdate([int timestamp])
  6. * Description: Get date/time information
  7. * Source code: ext/date/php_date.c
  8. */
  9. echo "*** Testing getdate() : basic functionality ***\n";
  10. //Set the default time zone
  11. date_default_timezone_set("Asia/Calcutta");
  12. // Initialise all required variables
  13. $timestamp = 10;
  14. // Calling getdate() with all possible arguments
  15. var_dump( getdate($timestamp) );
  16. // Calling getdate() with mandatory arguments
  17. var_dump( getdate() );
  18. ?>
  19. ===DONE===
  20. --EXPECTF--
  21. *** Testing getdate() : basic functionality ***
  22. array(11) {
  23. ["seconds"]=>
  24. int(10)
  25. ["minutes"]=>
  26. int(30)
  27. ["hours"]=>
  28. int(5)
  29. ["mday"]=>
  30. int(1)
  31. ["wday"]=>
  32. int(4)
  33. ["mon"]=>
  34. int(1)
  35. ["year"]=>
  36. int(1970)
  37. ["yday"]=>
  38. int(0)
  39. ["weekday"]=>
  40. string(8) "Thursday"
  41. ["month"]=>
  42. string(7) "January"
  43. [0]=>
  44. int(10)
  45. }
  46. array(11) {
  47. ["seconds"]=>
  48. int(%d)
  49. ["minutes"]=>
  50. int(%d)
  51. ["hours"]=>
  52. int(%d)
  53. ["mday"]=>
  54. int(%d)
  55. ["wday"]=>
  56. int(%d)
  57. ["mon"]=>
  58. int(%d)
  59. ["year"]=>
  60. int(%d)
  61. ["yday"]=>
  62. int(%d)
  63. ["weekday"]=>
  64. string(%d) %s
  65. ["month"]=>
  66. string(%d) %s
  67. [0]=>
  68. int(%d)
  69. }
  70. ===DONE===