DATEVALUE.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. // Date String, Result
  3. // Note that Excel fails ordinal number forms but PhpSpreadsheet parses them
  4. return [
  5. ['#VALUE!', '"25-Dec-1899"'],
  6. ['#VALUE!', '"31-Dec-1899"'],
  7. [1, '"1-Jan-1900"'],
  8. [59, '"1900/2/28"'],
  9. ['60', '"29-02-1900"'],
  10. ['60', '"29th February 1900"'], // ordinal
  11. [61, '"1900/3/1"'],
  12. [713, '"13-12-1901"'],
  13. [714, '"14-12-1901"'],
  14. [1461, '"1903/12/31"'],
  15. [1462, '"1-Jan-1904"'],
  16. [1463, '"2nd-Jan-1904"'], // ordinal
  17. [22269, '"19-12-1960"'],
  18. [25569, '"1st January 1970"'], // ordinal
  19. [30292, '"7-Dec-1982"'],
  20. [39448, '"1-1-2008"'],
  21. [50424, '"2038-01-19"'],
  22. [39601, '"2-6-2008"'],
  23. [39807, '"December 25th 2008"'], // ordinal
  24. [39448, '"1 Jan-2008"'],
  25. // MS Excel success or failure dependent on country settings
  26. [39813, '"12-31-2008"'],
  27. // PhpSpreadsheet tries to handle both US and UK formats, irrespective of country settings
  28. [39813, '"31-12-2008"'],
  29. // MS Excel success or failure dependent on country settings
  30. [39682, '"8/22/2008"'],
  31. // PhpSpreadsheet tries to handle both US and UK formats, irrespective of country settings
  32. [39682, '"22/8/2008"'],
  33. [39682, '"22/8/08"'],
  34. [39682, '"22-AUG-2008"'],
  35. [39501, '"2008/02/23"'],
  36. [39635, '"6-7-2008"'],
  37. // MS Excel success or failure dependent on country settings
  38. [39141, '"28-2-2007"'],
  39. // PhpSpreadsheet tries to handle both US and UK formats, irrespective of country settings
  40. [39141, '"2-28-2007"'],
  41. ['#VALUE!', '"29-2-2007"'],
  42. [36161, '"1/1/1999"'],
  43. [19925, '"1954-07-20"'],
  44. [36029, '"22 August 98"'],
  45. [39142, '"1st March 2007"'], // ordinal
  46. ['#VALUE!', '"The 1st day of March 2007"'],
  47. ['Y-01-01', '"1 Jan"'], // Jan 1 of the current year
  48. ['Y-12-31', '"31/12"'], // Dec 31 of the current year
  49. // Excel reads as 1st December 1931, not 31st December in current year.
  50. // This result is locale-dependent in Excel, in a manner not
  51. // supported by PhpSpreadsheet.
  52. [11658, '"12/31"'],
  53. ['Y-07-05', '"5-JUL"'], // July 5 of the current year
  54. ['Y-07-05', '"5 July"'], // July 5 of the current year
  55. [39783, '"12/2008"'],
  56. [11963, '"10/32"'],
  57. ['#VALUE!', '11'],
  58. ['#VALUE!', 'true'],
  59. ['#VALUE!', 'false'],
  60. ['#VALUE!', '1'],
  61. ['#VALUE!', '12345'],
  62. ['#VALUE!', '12'],
  63. [40210, '"Feb-2010"'], // implicit day of month is 1
  64. [40221, '"12-Feb-2010"'],
  65. [40221, '"Feb-12-2010"'], // MS Excel #VALUE!
  66. [40221, '"February-12-2010"'], // MS Excel #VALUE!
  67. [40221, '"February 12 2010"'], // MS Excel #VALUE!
  68. [40227, '"18 Feb 2010"'],
  69. [40254, '"17th 3rd 2010"'], // MS Excel #VALUE!
  70. [40227, '"Feb 18th 2010"'], // MS Excel #VALUE!
  71. [40210, '"1st Feb 2010"'], // MS Excel #VALUE!
  72. [40210, '"1st-Feb-2010"'], // Excel #VALUE!
  73. ['#VALUE!', '"1me Fev 2010"'],
  74. // MS Excel will fail with a #VALUE return, but PhpSpreadsheet can parse this date
  75. [40210, '"February 1st 2010"'], // Excel #VALUE!
  76. [40211, '"2nd Feb 2010"'], // Excel #VALUE!
  77. ['#VALUE!', '"Second Feb 2010"'],
  78. ['#VALUE!', '"First August 2010"'],
  79. [40391, '"1st August 2010"'], // Excel #VALUE!
  80. [0, '"15:30:25"'],
  81. ['#VALUE!', '"ABCDEFGHIJKMNOPQRSTUVWXYZ"'],
  82. ['#VALUE!', '1999'],
  83. ['#VALUE!', '"32/32"'],
  84. ['#VALUE!', '"1910-"'],
  85. ['#VALUE!', '"10--"'],
  86. ['#VALUE!', '"--10"'],
  87. ['#VALUE!', '"--1910"'],
  88. //['#VALUE!', '-JUL-1910'], We can parse this, Excel can't
  89. ['#VALUE!', '"2008-08-"'],
  90. [36751, '"0-08-13"'],
  91. ['#VALUE!', 'Q15'],
  92. ['#VALUE!', 'false'],
  93. ['#VALUE!', 'true'],
  94. [19925, 'B1'],
  95. ];