DATE_FORMAT(FROM_UNIXTIME(`unixtimeThing`), '%d-%m-%Y %H:%i:%s') as "Date"

I thought this was useful to remember. The below is the MySQL to convert a unix time string into date format:

DATE_FORMAT(FROM_UNIXTIME(`unixtimeThing`), '%d-%m-%Y %H:%i:%s') as 'Date'

Remember, if your unixtimeThing is in milliseconds, just divide by 1000 in the FROM_UNIXTIME brackets.


Comments