compare two date

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
amain
Forum Newbie
Posts: 2
Joined: Sat Mar 25, 2006 10:53 pm

compare two date

Post by amain »

I want the coding to compare between two date
If date one exceed date two then anything..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

if($date1 > $date2)
{
// $date1 "exceeds" $date2
}
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I believe the dates would have to be timestamps before you could compare them. If they're not, use strtotime() on them and then compare
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply