Time and Date functions

Fred's picture

Drupal stores time information (such as created date, modified date, etc) in unix date format as int(11).
Using a simple statement:

SELECT n.`created` FROM node n

1225678626

FROM_UNIXTIME()

Formats the data as date & time:

SELECT FROM_UNIXTIME(n.created) FROM node n

2008-11-03 02:17:04

DATE()

Just the date:

SELECT DATE(FROM_UNIXTIME(n.created))  FROM node n

2008-11-03

Note:

Of course, you could (should?) process the date in the software you are using instead.