clueless

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kjhngisd
Forum Newbie
Posts: 3
Joined: Thu Jun 11, 2009 2:43 pm

clueless

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: clueless

Post by Christopher »

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

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

This will work: strtotime("2009-06-16");
(#10850)
kjhngisd
Forum Newbie
Posts: 3
Joined: Thu Jun 11, 2009 2:43 pm

Re: clueless

Post 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.
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: clueless

Post 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
Post Reply