Page 1 of 1

clueless

Posted: Thu Jun 11, 2009 2:47 pm
by kjhngisd
Hey there.
I'm not a php-guy, but have been assigned to a php site. So I'm comfortable with other development, but my php is terrible.

So, any help would be awesome.

Here's my issue. This statement:
print date("m-d-Y", strtotime("06-16-2009"));

prints
09-29-2012

why?
If I understand it, the hard coded date should convert a (Unix-like) time, then back to a date with the format. So it *should* print the hardcoded value. Where in the world does it come up with the date it has?

Hellllllppp :D
thanks for any thoughts.

Re: clueless

Posted: Thu Jun 11, 2009 2:56 pm
by Christopher
This will not work: strtotime("06-16-2009");

This will work: strtotime("06/16/2009");

This will work: strtotime("2009-06-16");

Re: clueless

Posted: Thu Jun 11, 2009 3:04 pm
by kjhngisd
arborint wrote:This will not work: strtotime("06-16-2009");

This will work: strtotime("06/16/2009");

This will work: strtotime("2009-06-16");
thanks.

Re: clueless

Posted: Thu Jun 11, 2009 3:06 pm
by omniuni
If you aren't familiar with it, the online manual for PHP is great. Check out the page below. In the second post down, Viper7 discusses the formats that the function expects.

http://us2.php.net/manual/en/function.strtotime.php