Re: convert date from UK to US for strtotime
| From: | CPT John W. Holmes | Date: | Wed, 14 Jan 2004 13:57:27 +0000 |
| Subject: | Re: convert date from UK to US for strtotime | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174547@lists.php.net to get a copy of this message | ||
From: "Jon Bennett" <flashcoder@jben.net>
> I'm trying to re-work this code from the php site
> <http://uk.php.net/strtotime> so that my users can input
> dates in UK
> format (dd-mm-yyyy) and still use strtotime.
>
> // from http://uk.php.net/strtotime
>
> $date=explode("/",trim($records[2]));
> $posted=strtotime ($date[1]."/".$date[0]."/".$date[2]);
If you're going to split the date apart into it's components, why not just
use mktime()? There's no reason that you _need_ to use strtotime(), is
there?
$posted = mktime(0,0,0,$date[1],$date[0],$date[2]);
---John Holmes...