August 18, 2004

Converting dates between MySQL and PHP

Thanks Simon, for the tip. "You can use MySQL's UNIX_TIMESTAMP() and FROM_UNIXTIME() functions to convert Unix timestamps to MySQL date types as part of your SQL queries." For example,
SELECT 
  entries.*, UNIX_TIMESTAMP(added) as unixtime
FROM 
  enries
...
and
INSERT INTO 
  entries
SET  
  title = 'The title', 
  added = FROM_UNIXTIME(1057941242),
...
Yay! No more INT(11) for me.

Posted by torque at August 18, 2004 11:56 AM | TrackBack
Comments

Madonna says she may adopt another child from abroad following her proposed adoption of a Malawian boy...

Posted by: Haden Sowers at December 7, 2006 4:17 AM
Post a comment









Remember personal info?