Re: Bilingual strtotime()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yeah I think that's the only way out for now.
I had to do something similar when using strftime() but the same can be done when using strtotime(). You just have to be careful with abbreviated names.
Check out the source code here:http://code.google.com/p/raxan/source/browse/trunk/raxan/sdk/raxan/pdi/shared/raxan.datetime.php

Best regards,__Raymond


--- On Sun, 2/6/11, Alexis <phplists1@xxxxxxxxxxxxxxx> wrote:

From: Alexis <phplists1@xxxxxxxxxxxxxxx>
Subject: Re:  Bilingual strtotime()
To: 
Cc: php-general@xxxxxxxxxxxxx
Date: Sunday, February 6, 2011, 3:38 PM



On 06/02/11 04:54, Ashley Sheridan wrote:
> On Sun, 2011-02-06 at 11:24 +0100, Peter Lind wrote:
>
>> On Feb 6, 2011 11:16 AM, "Per Jessen"<per@xxxxxxxxxxxx>  wrote:
>>>
>>> Alexis wrote:
>>>
>>>> I was wondering if there was a way to use the strtotime() function
>>>> when the months are in one or the other of the above two languages?
>>>
>>> Ah, I misread this earlier - strtotime(), not strftime().  You're
>>> talking about transforming from text to a locale()-neutral format.  I
>>> don't think strtotime() is locale-sensitive - according to the manual:
>>>
>>> "The function [strtotime] expects to be given a string containing an
>>> English date format"
>>>
>>>
>>>
>>
>> Strtotime can read a number of formats, but does (from experience) have
>> problems with some. It won't work with textual dates in anything but
>> English, far as I know.
>>
>> Regards
>> Peter
>
>
> Is there an example of the different date formats so that we can see
> what we're working with here? It sounds like it might require a little
> manual intervention first (str_replace() maybe) in order for this to
> work.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

So basically, the answer is no :)
Looks like I'll simply do a replace of the French named months with 
English ones.

Would have thought the length of time that PHP has been around and with 
people around the world, speaking more than just one language, that 
language support would have progressed further than it appears to have. 
Apparently not.

But thanks for all the suggestions.

Alexis

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux