Gill Bates Gill Bates - 7 months ago 17
SQL Question

How to extract hour for MySQL FROM_UNIXTIME() results?

I have a column with time of measurments in timestamps in INT, and I need group data by interval of a hour. I already discovered MySQL function FROM_UNIXTIME(), but is there internal instrument in MySQL to extract hour from results of this function?

Answer

I think you mean FROM_UNIXTIME

GROUP BY
    DATE_FORMAT(FROM_UNIXTIME(time_column), '%Y %m %d %H'))