note 51732 added to function.time

From: Date: Fri, 08 Apr 2005 21:05:21 +0000
Subject: note 51732 added to function.time
Groups: php.notes 
Request: Send a blank email to php-notes+get-87724@lists.php.net to get a copy of this message
i decide to create a function for converting MySQL timestamp(14) to datetime.. function datetime($YYYYMMDDHHMMSS) { list($year,$month,$day,$hour,$minute,$seconds) = sscanf($YYYYMMDDHHMMSS,'%4s%2s%2s%2s%2s%2s'); return date('Y-m-d h:i:s', mktime($hour,$minute,$seconds,$month,$day,$year)); } echo datetime("20040422090941"); //output 2004-04-22 09:09:41 ---- Manual Page -- http://www.php.net/manual/en/function.time.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51732 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51732&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51732&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51732&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51732&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51732&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51732&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87724) next »