Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

date comparisons

Codes here !

Moderators: macek, egami, gesf

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!
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron