note 102344 added to function.date

From: Date: Wed, 09 Feb 2011 21:47:47 +0000
Subject: note 102344 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-176822@lists.php.net to get a copy of this message
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); ---- Server IP: 69.147.83.197 Probable Submitter: 190.177.198.168 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/102344 Del: integrated -- https://master.php.net/note/delete/102344/integrated Del: useless -- https://master.php.net/note/delete/102344/useless Del: bad code -- https://master.php.net/note/delete/102344/bad+code Del: spam -- https://master.php.net/note/delete/102344/spam Del: non-english -- https://master.php.net/note/delete/102344/non-english Del: in docs -- https://master.php.net/note/delete/102344/in+docs Del: other reasons-- https://master.php.net/note/delete/102344 Reject -- https://master.php.net/note/reject/102344 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#176822) next »