1. We have moved to a new forum! There may be a few things not working properly so please let us know if you find a bug. Remember to use the bbCode [ sql ] tag for SQL statements.

How do I format mySQL date?

Discussion in 'SQL - Questions and Answers' started by Kut, Dec 20, 2006.

  1. Kut Guest

    Dialect: MySQL
    I have a forum and would like to run a query where I can get the member id, topic id and date that it was read. I am able to do this but the date comes out in an unreable 10 digit number. How do I run the query so it reads as a regular date>

    Below, I am looking for topic id 5160 to see all the member ids who read it and the dates.

    SELECT 5160, read_mid, read_date FROM ibf_topics_read
  2. ben Administrator

    Dialect: MySQL
    I think your date is stored as a UNIX timestamp. MySQL has functions to convert this to 'normal' date formats. See http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html for more info.

    SQL:

    SELECT read_mid, FROM_UNIXTIME(read_date) as read_date FROM ibf_topics_read WHERE id = 5160

Share This Page