Skip to content

Instantly share code, notes, and snippets.

@JRyven
Last active June 26, 2019 09:25
Show Gist options
  • Save JRyven/aa6aabf112377e8987302c9f4336e142 to your computer and use it in GitHub Desktop.
Save JRyven/aa6aabf112377e8987302c9f4336e142 to your computer and use it in GitHub Desktop.
PHP Date Functions and Transformations
<?php
// Get the current date array | $thedate[0] contains the unix timestamp
$thedate = getdate();
// Make a date object using pretty much any human redable date/time
$date_object = strtotime(9-5-1985 1:00 AM);
// Format the date object
$date_formatted = date('Y-m-d', $date_object);
// Make a date object using pretty much any human redable date/time & format!
$event_start_date_unix = date('U', strtotime(9-5-1985 1:00 AM));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment