date question

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
User avatar
speedy33417
Forum Contributor
Posts: 128
Joined: Sun Jul 23, 2006 1:14 pm

date question

Post by speedy33417 »

I'm working with dates in a db that store in a YYYY-MM-DD HH:MM:SS format. What is the easiest way to do the following?

1) Determining what day of the week that is (Mon, Tue...)
2) Adding one day to it (where it calculates a new month, year, leap year...)
3) Adding one hour to it
4) Calculating the difference between dates

Thanks
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

You could explore MySQL's temporal functions, or use strtotime() from PHP
Post Reply