[mythtv-users] OT mysql datetime

Nicolas Krzywinski myth at site7even.de
Tue Apr 28 22:38:54 UTC 2015


Am 28.04.2015, 18:15 Uhr, schrieb <mythtv-users-request at mythtv.org>:

> Message: 4
> Date: Tue, 28 Apr 2015 14:48:48 +0200
> From: Hika van den Hoven <hikavdh at gmail.com>
> To: Discussion about MythTV <mythtv-users at mythtv.org>
> Subject: [mythtv-users] OT mysql datetime
> Message-ID: <56203854.20150428144848 at gmail.com>
> Content-Type: text/plain; charset=us-ascii
> Hoi All,
> I'm working on some new unrelated mysql database and I'm encountering
>  some weird datetime behaviour. I was wondering if any of you could
>  enlighten me. The server is running mysql 5.6.22
> I've created a new table with both a timestamp and a datetime field.
>  The timestamp field gets filled with local time values. If I use NOW()
>  or CURRENT_TIMESTAMP in an INSERT query I get UTC time?
> I don't mind in this database which is used, but of cause I want it to
>  be consistent. What am I doing wrong? Both server and the workstation
>  is correctly setup on timezone and running on UTC? I don't think I
>  explicitly set up mysql timezone. It gets it from the system.
>
Hi Hika,

I just checked this on my system and there now() inserts the current  
localized time (UTC+2).

The ref manual is quite interesting as well:  
http://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_now

Maybe things will work as expected if you set your systems timestamps to  
the correct localized times?
Btw. you are speaking of the mysql function now() as well? Cause I mixed  
this up with the php function some times ago which e. g. may have its own  
localization settings.

Good luck,
Nicolas

-- 
Erstellt mit Operas E-Mail-Modul: http://www.opera.com/mail/


More information about the mythtv-users mailing list