Skip to content

Instantly share code, notes, and snippets.

@yaza-putu
Created July 31, 2020 07:27
Show Gist options
  • Save yaza-putu/f2a339192061423e894df082e51af4d9 to your computer and use it in GitHub Desktop.
Save yaza-putu/f2a339192061423e894df082e51af4d9 to your computer and use it in GitHub Desktop.
Convert date excel to date php
Please use this formula to change from Excel date to Unix date, then you can use "gmdate" to get the real date in PHP:
UNIX_DATE = (EXCEL_DATE - 25569) * 86400
and to convert from Unix date to Excel date, use this formula:
EXCEL_DATE = 25569 + (UNIX_DATE / 86400)
After putting this formula into a variable, you can get the real date in PHP using this example:
$UNIX_DATE = ($EXCEL_DATE - 25569) * 86400;
echo gmdate("d-m-Y H:i:s", $UNIX_DATE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment