note 31960 added to function.strtotime
| From: | webmaster at hivemail dot com | Date: | Sat, 10 May 2003 10:39:08 +0000 |
| Subject: | note 31960 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47814@lists.php.net to get a copy of this message | ||
Need to turn a 24-hours formatted time to 12-hours format?
// Please note that seconds are ignored
// Use 'h:i:s A' as the format to change that
function time24to12($time) {
return date('h:i A', strtotime(date('m/d/Y ').$time));
}
echo time24to12('15:49'); // will echo 03:49 PM
--
http://www.php.net/manual/en/function.strtotime.php
http://master.php.net/manage/user-notes.php?action=edit+31960
http://master.php.net/manage/user-notes.php?action=delete+31960
http://master.php.net/manage/user-notes.php?action=reject+31960