note 102344 deleted from function.date by danbrown

From: Date: Wed, 09 Feb 2011 21:49:00 +0000
Subject: note 102344 deleted from function.date by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176823@lists.php.net to get a copy of this message
Note Submitter: guiwoda ---- Quote: ------ <?php $d="2010-01-31 09:06:09"; $i= strtotime($d); echo $d; echo "<br>"; echo date("Y-m-d h:m:s",$i); ?> this gives the output: 2010-01-31 09:06:09 2010-01-31 09:01:09 very small change but still not accurate. ------ This is not true. The date function is accurate. The error lies in the format string: 'Y-m-d h:m:s' will give Year Month Day Hours Month Second. The correct way of doing it would be: date('Y-m-d H:i:s', $i);

« previous php.notes (#176823) next »