note 48419 added to function.strtotime

From: Date: Wed, 22 Dec 2004 23:34:57 +0000
Subject: note 48419 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-82192@lists.php.net to get a copy of this message
For the "rest of the world" who dont use american date format ie. use dd/mm/yy NOT mm/dd/yy Using the pregmatch line shown below should convert any dates in this format to the correct format... HOWEVER dates in yy/mm/dd will no longer be able to be parsed, not a big loss if you ask me. $input = "12/02/05"; echo date('d M Y',strtotime($input)); $input = preg_replace( '/(\d{2})\W(\d{2})\W(\d{2}|\d{4})/', '$2/$1/$3', $input); echo date('d M Y',strtotime($input)); ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48419 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48419&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48419&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48419&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48419&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48419&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48419&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48419&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82192) next »