catsoup
-
Posts
2 -
Joined
-
Last visited
Posts posted by catsoup
-
-
Hi All,
What do you think this should give? :
echo strtotime('I');
(Thats a capital 'i')
On my PHP 5.2.6 and PHP 5.3.3 and system, it seems to give a time nine hours previously:
$ cat test.php<?phpdate_default_timezone_set('UTC');$s="I";echo "strtotime('$s')=".strtotime($s)."\n";echo "date(strtotime('$s'))=".date(DATE_RFC822,strtotime($s))."\n";echo "now=".date(DATE_RFC822)."\n";$ php test.phpstrtotime('I')=1377749122date(strtotime('I'))=Thu, 29 Aug 13 04:05:22 +0000now=Thu, 29 Aug 13 13:05:22 +0000Anyone know what format of date/time a single capital 'I' is matching?
Cheers!
strtotime('I')
in PHP Coding Help
Posted · Edited by catsoup
Thanks for the replies,
I would actually prefer it to return false for a string like "I " rather than a date. The code I have is checking for dates embeded in text, and they will always be at the start of a string. Unfortunately the date can be just about any format the users PC has it set to, so I cant look for specific formats. I realise that 100% accuracy is therfore not possible, but 99% will do
I did consider it was considering it to be roman numerals, but 'IV', 'V' or 'II' does return false, so I gave up on that idea.
For now, I will leave my code checking for 'I<space>' at the start of a string. Not pretty, but I dont have time right now to step through the PHP souce.
Anyway,
Thanks for the replies