Trouble with date function

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
Milan
Forum Commoner
Posts: 97
Joined: Wed May 17, 2006 6:08 pm

Trouble with date function

Post by Milan »

I am trying to display the date in this format

mm/dd/yyyy hh:mm:ss

but with no luck, anyone has expirience with formating the date function?
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Milan
Forum Commoner
Posts: 97
Joined: Wed May 17, 2006 6:08 pm

Post by Milan »

Cool , thanks!

Mistake was not placing the formating in the ""

like

Code: Select all

echo date("m/d/Y H:i:s");
Milan
Forum Commoner
Posts: 97
Joined: Wed May 17, 2006 6:08 pm

ohhh man

Post by Milan »

Now the main question , how can i display a date that's 7 days from now?

Code: Select all

print(date("m/d/Y H:i:s",mktime(0,0,0,0,(0 + 7),2006)));
i cant figure out how to do it with mktime()
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Re: ohhh man

Post by Oren »

Milan wrote:i cant figure out how to do it with mktime()
Then don't :P

Code: Select all

echo date("m/d/Y H:i:s", strtotime("+1 week"));
Milan
Forum Commoner
Posts: 97
Joined: Wed May 17, 2006 6:08 pm

Post by Milan »

WOW!

hat's off!

thanks!
Post Reply