Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
Comparing MySQL date with UNIX timestamp (Read 4090 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Comparing MySQL date with UNIX timestamp
25.11.06 at 22:51:26
 
Comparing MySQL date with UNIX timestamp
 
It is difficult to compare a date / timestamp variable in PHP with a date retrieved from a MySQL database. A PHP timestamp is the number of seconds since 1/jan/1970.  
 
I needed to compare a retrieved date from MySQL with the current timestamp which I retrieved using the PHP time() function.
 
I found out that the easiest way to do this is to retrieve the MySQL date as a unix timestamp using: select UNIX_TIMESTAMP(mydate) from mytable;
 
Deducting the MySQL date from the current timestamp it results in the number of seconds between the two dates.
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1