DATEVALUE

Converts a date in the form of text to a serial number.


Warning: The PhpSpreadsheet DATEVALUE() function accepts a wider range of date formats than MS Excel's DATEFORMAT() function.

Date String Formula Excel DateStamp Formatted DateStamp
26 March 2012=DATEVALUE(A1)40994
Warning: Trying to access array offset on value of type null in /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation.php on line 3269
2012-Mar-26
29 Feb 2012=DATEVALUE(A2)40968
Warning: Trying to access array offset on value of type null in /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation.php on line 3269
2012-Feb-29
April 1, 2012=DATEVALUE(A3)41000
Warning: Trying to access array offset on value of type null in /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation.php on line 3269
2012-Apr-01
25/12/2012=DATEVALUE(A4)41268
Warning: Trying to access array offset on value of type null in /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation.php on line 3269
2012-Dec-25
2012-Oct-31=DATEVALUE(A5)41213
Warning: Trying to access array offset on value of type null in /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation.php on line 3269
2012-Oct-31
5th November=DATEVALUE(A6)
Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php:517 Stack trace: #0 [internal function]: PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEVALUE() #1 /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation.php(3748): call_user_func_array() #2 /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation.php(2758): PhpOffice\PhpSpreadsheet\Calculation->processTokenStack() #3 /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation.php(2562): PhpOffice\PhpSpreadsheet\Calculation->_calculateFormulaValue() #4 /var/www/erp/spreadsheet/src/PhpSpreadsheet/Cell.php(274): PhpOffice\PhpSpreadsheet\Calculation->calculateCellValue() #5 /var/www/erp/spreadsheet/src/PhpSpreadsheet/Cell.php(184): PhpOffice\PhpSpreadsheet\Cell->getCalculatedValue() #6 /var/www/erp/spreadsheet/docs/Examples/Calculations/DateTime/DATEVALUE.php(63): PhpOffice\PhpSpreadsheet\Cell->getFormattedValue() #7 {main} thrown in /var/www/erp/spreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php on line 517