note 49746 added to function.date

From: Date: Mon, 07 Feb 2005 18:53:14 +0000
Subject: note 49746 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-84627@lists.php.net to get a copy of this message
This is a function to transform a MySQL timestamp(14) field into a formated date: <? function formatDate($mod = 0, $date = 'now') { if($date == 'now') { $date = date('YmdHis'); } // if no date set get the present date as timestamp(14) $format = array( "D, jS F Y", // Mon, 7th January 1988 "jS F Y", // 7th January 1988 "j/n/Y", // 7/1/1988 "d-m-Y" // 07-01-1988 // for more formats please read the //date manual at: http://www.php.net/manual/en/function.date.php ); if($mod >= count($format)) $mod = 0; // the index of format starts from 0 $fdate = date($format[$mod], mktime(($date/10000)%100, ($date/100)%100, $date%100, ($date/100000000)%100, ($date/1000000)%100, $date/10000000000 )); return $fdate; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49746 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49746&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49746&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49746&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49746&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49746&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49746&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84627) next »