Skip to content

Instantly share code, notes, and snippets.

@leocaseiro
Created June 25, 2014 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leocaseiro/c971545202688f42032d to your computer and use it in GitHub Desktop.
Save leocaseiro/c971545202688f42032d to your computer and use it in GitHub Desktop.
Create timestamp from dd/mm/yyyy H:m with PHP >= 5.3
<?php
$datetime = '01/06/1985 15:45';
$timestamp = DateTime::createFromFormat('d/m/Y H:i', $datetime)->getTimestamp();
echo $timestamp;
$datetime = date('d-m-Y H:i', $timestamp);
var_dump($datetime);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment