Re: strtotime problem

From: Date: Wed, 08 Oct 2008 11:42:02 +0000
Subject: Re: strtotime problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-281584@lists.php.net to get a copy of this message
Thodoris wrote:
I know that *strtotime*() only recognises the formats mm/dd/yyyy, yyyy-mm-dd and yyyymmdd ****for numeric months but I need do something like that: function dateWebToMysql($webdate){
    $format = 'Y-m-d';
    $timestamp = strtotime($webdate);
    return date($format,$timestamp);
    }
print dateWebToMysql('01/03/2008'); Where 01/03/2008 is in dd/mm/yyyy format (not the American format). What is the best way of doing this? Any ideas?
completely random and never used myself [ie just made it up] function dateWebToMysql( $webdate ){ return strtotime(strrev( str_replace('/','', $webdate) )); } -- nathan ( nathan@kraya.co.uk ) { Senior Web Developer php + java + flex + xmpp + xml + ecmascript web development edinburgh | http://kraya.co.uk/ }

« previous php.general (#281584) next »