Re: newbie date time question
| From: | Shawn McKenzie | Date: | Thu, 23 Jun 2011 00:04:05 +0000 |
| Subject: | Re: newbie date time question | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313671@lists.php.net to get a copy of this message | ||
On 06/22/2011 06:54 PM, David Nicholls wrote:
>> I'm late to the party, but strtotime works great, though you need to
>> give it what it expects:
>>
>> $ts = strtotime(str_replace('/', '-', $date));
>>
>
> Thanks, Shawn, that's a bit more elegant! I'll give it a go. I didn't
> know how to do the str_relace bit. Thanks
The deal is that if you use the / then strtotime interprets it as m/d/y
and if you use - it interprets it as d-m-y.
--
Thanks!
-Shawn
http://www.spidean.com