| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
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