Skip to content

Instantly share code, notes, and snippets.

@vielhuber
Last active November 24, 2024 10:19
Show Gist options
  • Save vielhuber/613b3430a326382289197b87f3ac3854 to your computer and use it in GitHub Desktop.
Save vielhuber/613b3430a326382289197b87f3ac3854 to your computer and use it in GitHub Desktop.
date 32-bit 64-bit overflow DateTime 2038 #php
// 32-bit
if (PHP_INT_SIZE == 4) {
echo date('Y-m-d',strtotime('2040-01-10T16:41:07+01:00'));
}
// 64-bit
if (PHP_INT_SIZE == 8) {
echo (new \DateTime('2040-01-10T16:41:07+01:00'))->format('Y-m-d');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment