21 March 2013

If you have a lot of content with timestamps, you might want to get all the years where the content belongs. For an example created. With this query you can get years when some content was created.

Source code viewer
  1. SELECT DISTINCT DATE_FORMAT(FROM_UNIXTIME(time_field), '%Y') FROM table_name
Programming Language: MySQL