note 38594 deleted from function.strtotime by aidan

From: Date: Wed, 11 Aug 2004 18:22:45 +0000
Subject: note 38594 deleted from function.strtotime by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74489@lists.php.net to get a copy of this message
Note Submitter: scott@pigandcow.com ---- Unfortunately, strtotime() can't convert mysql timestamps of the form YYYYMMDDhhmmss (the default 14 character timestamp). Here's a function to do it for you: function convert_timestamp ($timestamp, $adjust="") { $timestring = substr($timestamp,0,8)." ". substr($timestamp,8,2).":". substr($timestamp,10,2).":". substr($timestamp,12,2); return strtotime($timestring." $adjust"); } Remember that the $adjust string needs to be properly spaced- "+ 30 days", not "+30days"!

« previous php.notes (#74489) next »