Skip to content

Instantly share code, notes, and snippets.

@jrignacio
Created December 9, 2010 06:49
Show Gist options
  • Save jrignacio/734420 to your computer and use it in GitHub Desktop.
Save jrignacio/734420 to your computer and use it in GitHub Desktop.
Date and time with ms in GMT+8
<?php
function datetime() {
date_default_timezone_set('Asia/Singapore');
$microtime = explode(" ",microtime());
$time = (int)$microtime[1];
$milliseconds = round($microtime[0]*1000);
$milliseconds = sprintf("%03d", $milliseconds);
$datetime = date('Y-m-d H:i:s',$time).'.'.$milliseconds;
return $datetime;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment