Skip to content

Instantly share code, notes, and snippets.

@pkdavies
Created June 21, 2011 11:02
Show Gist options
  • Save pkdavies/1037627 to your computer and use it in GitHub Desktop.
Save pkdavies/1037627 to your computer and use it in GitHub Desktop.
MySQL timestamp format to human readable
function mysql_timestamp_to_human($dt){
$yr=strval(substr($dt,0,4));
$mo=strval(substr($dt,4,2));
$da=strval(substr($dt,6,2));
$hr=strval(substr($dt,8,2));
$mi=strval(substr($dt,10,2));
//$se=strval(substr($dt,12,2));
return date("m/d/Y H:i", mktime ($hr,$mi,0,$mo,$da,$yr))." GMT";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment