note 17936 added to function.date
| From: | poknam at hotmail dot com | Date: | Fri, 04 Jan 2002 06:20:40 +0000 |
| Subject: | note 17936 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-24381@lists.php.net to get a copy of this message | ||
change the format of date
//e.g. timestamp = 2002-01-04 13:34:26
//format = Y-m-d H:i:s
list($date, $time) = explode(" ", $timestamp);
//modify "-" if your input is separated by other char
//modify the sequence of $yr, $mon and $day if your input is in different sequence
list($yr, $mon, $day) = explode ("-", $date);
//modify ":" if your input is separated by other char
//modify the sequence of $hr, $min and $sec if your input is in different sequence
list($hr, $min, $sec) = explode(":", $time);
$newtime = mktime($hr, $min, $sec, $mon, $day, $yr);
//then you can change the format of date as you like
$newdate = date("d-m-Y H:i:s", $newtime);
//newdate = 04-01-2002 13:34:26
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+17936
http://master.php.net/manage/user-notes.php?action=delete+17936
http://master.php.net/manage/user-notes.php?action=reject+17936