Skip to content

Instantly share code, notes, and snippets.

@BenBroide
Created July 9, 2019 22:17
Show Gist options
  • Save BenBroide/ea272dc67bbd643fadd72957ece70c65 to your computer and use it in GitHub Desktop.
Save BenBroide/ea272dc67bbd643fadd72957ece70c65 to your computer and use it in GitHub Desktop.
Date time from time stamp
<?php
// This will error and break code
$datetime = new DateTime( 1565301395 );
var_dump( $datetime );
// This will work
$datetime = new DateTime();
$datetime->setTimestamp(1565301395);
var_dump( $start_date );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment