date comparisons

Codes here !

Moderators: macek, egami, gesf

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Sun Jan 05, 2003 10:27 am

You can use this to compare two dates and act as you want -->

Code: Select all

echo ( strtotime ("22 September 2006") - strtotime ("now") );

strtotime gives you the number of seconds since January 1 1970 00:00:00 GMT (UNIX Epoch)

As you see it gives you the difference between these two dates, so you can compare them using an if, and if the value is less than 0, it means the period expired.

bye!

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest