0

what is the best way to transform unix timestamp in european date format ? I use DATE_FORMAT(FROM_UNIXTIME(i.opened), '%d/%m/%Y %H:%i') AS DATE_OUVERTURE but infortunately it doesn't handle the timezone or maybe my database has a wrong configuration. I tried the function CONVERT_TZ but I noticed that it doesn't like european format.

GwydionFR
  • 787
  • 1
  • 10
  • 25
  • Whad do you exactly mean by `european date format` ? Different countries in Europe use various date formats, see this link: https://en.wikipedia.org/wiki/Date_format_by_country – krokodilko Jul 15 '15 at 08:01
  • dd/mm/yyyy HH:mm but it is written in sql in my first post – GwydionFR Jul 15 '15 at 08:03
  • 1
    Just [set the timezone](http://stackoverflow.com/questions/930900/how-to-set-time-zone-of-mysql) when you initialize the connection. – Vatev Jul 15 '15 at 08:04

2 Answers2

0

SET time_zone = 'Europe/Paris' resolved my problem thanks to your link Vatev.

GwydionFR
  • 787
  • 1
  • 10
  • 25
0

If you want to format a local date according to the local format, you should check out strftime along with setlocale.

Luke
  • 1,369
  • 1
  • 13
  • 37