From: Philip Thompson on
Hello all.

Long time no see! Anyway, I'm having an issue with strtotime(). Why do the following return valid timestamps?

<?php
echo strtotime ('a').': '.date ("m/d/Y", strtotime ('a'))."<br/>";
echo strtotime ('a,a').': '.date ("m/d/Y", strtotime ('a,a'))."<br/>";
echo strtotime ('a,a,a').': '.date ("m/d/Y", strtotime ('a,a,a'))."<br/>";
?>

These result in today's date:

1273049449: 05/05/2010
1273049449: 05/05/2010
1273049449: 05/05/2010

Each time the page is reloaded, the seconds jump up... but still today's date. Why is this? I can repeat the same results by changing the 'a' to any other single letter: "g" or "h,k" or "r,s,t" or whatever - all the same result.

Thanks,
~Philip
From: Peter Lind on
On 5 May 2010 16:58, Philip Thompson <philthathril(a)gmail.com> wrote:
> Hello all.
>
> Long time no see! Anyway, I'm having an issue with strtotime(). Why do the following return valid timestamps?
>
> <?php
> echo strtotime ('a').': '.date ("m/d/Y", strtotime ('a'))."<br/>";
> echo strtotime ('a,a').': '.date ("m/d/Y", strtotime ('a,a'))."<br/>";
> echo strtotime ('a,a,a').': '.date ("m/d/Y", strtotime ('a,a,a'))."<br/>";
> ?>
>
> These result in today's date:
>
> 1273049449: 05/05/2010
> 1273049449: 05/05/2010
> 1273049449: 05/05/2010
>
> Each time the page is reloaded, the seconds jump up... but still today's date. Why is this? I can repeat the same results by changing the 'a' to any other single letter: "g" or "h,k" or "r,s,t" or whatever - all the same result.
>

This was discusses a little while ago, have a look at
news.php.net/php.general/303839/Logical-reason-for-strtotime-east-and-strtotime-west-returningvalid-results.html
and the responses.

Regards
Peter

--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>
From: Philip Thompson on
On May 5, 2010, at 10:12 AM, Peter Lind wrote:

> On 5 May 2010 16:58, Philip Thompson <philthathril(a)gmail.com> wrote:
>> Hello all.
>>
>> Long time no see! Anyway, I'm having an issue with strtotime(). Why do the following return valid timestamps?
>>
>> <?php
>> echo strtotime ('a').': '.date ("m/d/Y", strtotime ('a'))."<br/>";
>> echo strtotime ('a,a').': '.date ("m/d/Y", strtotime ('a,a'))."<br/>";
>> echo strtotime ('a,a,a').': '.date ("m/d/Y", strtotime ('a,a,a'))."<br/>";
>> ?>
>>
>> These result in today's date:
>>
>> 1273049449: 05/05/2010
>> 1273049449: 05/05/2010
>> 1273049449: 05/05/2010
>>
>> Each time the page is reloaded, the seconds jump up... but still today's date. Why is this? I can repeat the same results by changing the 'a' to any other single letter: "g" or "h,k" or "r,s,t" or whatever - all the same result.
>>
>
> This was discusses a little while ago, have a look at
> news.php.net/php.general/303839/Logical-reason-for-strtotime-east-and-strtotime-west-returningvalid-results.html
> and the responses.
>
> Regards
> Peter

Thanks for the link. I did a little bit more research and found a site that may help explain what is happening.

http://wwp.greenwichmeantime.com/info/timezone.htm

In the column labeled "Zone" are all the letters of the alphabet (except J). So, then I thought to print the times with the date() functions above - they were various time(zones). Basically, I think strotime() is just ignoring the characters after the first comma in the values above, so then it was finding valid timezones. Odd.

Hope this helps someone in the future....

Thanks,
~Philip