now() returns the current system time which doesn't really have a great deal
to do with time zones.

You can check what the current time zone is set to with the following
command

*show variables like 'time_zone';*

but that is likely to return the value '*SYSTEM*' which means it takes the
value from the host operating system ( usually set in /etc/timezone ).

You can set the time_zone variable either globally or per session to an
offset of UTC as follows

*SET time_zone='+00:00:00';*
*SET GLOBAL time_zone='+00:00:00';*

Or you can specify a '*default_time_zone*' in your my.cnf/my.ini options
file.

You can also set the time_zone variables to a named offset which will then
take account of daylight savings times but to do this you must first load
the mysql time zone tables.

I strongly suggest you read the manual section relating to time zone support
which you can find here

http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html



On 3 June 2011 10:27, Rocio Gomez Escribano
<r.go...@ingenia-soluciones.com>wrote:

> I’m afraid I don’’t understand you:
>
>
>
>
>
> mysql> select count(*) from mysql.time_zone_name;
>
> +----------+
>
> | count(*) |
>
> +----------+
>
> |        0 |
>
> +----------+
>
> 1 row in set (0.00 sec)
>
>
>
> But, when I execute:
>
>
>
>
>
> mysql> select now();
>
> +---------------------+
>
> | now()               |
>
> +---------------------+
>
> | 2011-06-03 11:28:00 |
>
> +---------------------+
>
> 1 row in set (0.00 sec)
>
>
>
> That’s correct, in Spain it’s that time. So, mysql is using the timezone
> correctly, isn’t it?
>
>
>
> Thanks!
>
>
>
> *Rocío Gómez Escribano*
>
> r.go...@ingenia-soluciones.com <r.sanc...@ingenia-soluciones.com>
>
>
>
> [image: Descripción: cid:image002.jpg@01CB8CB6.ADEBA830]
>
> Polígono Campollano C/F, nº21T
>
> 02007 Albacete (España)
>
> Tlf:967-504-513  Fax: 967-504-513
>
> www.ingenia-soluciones.com
>
>
>
> *De:* John Daisley [mailto:daisleyj...@googlemail.com]
> *Enviado el:* viernes, 03 de junio de 2011 11:18
> *Para:* Rocio Gomez Escribano
> *CC:* mysql@lists.mysql.com
> *Asunto:* Re: timezone
>
>
>
> Have you populated the timezone tables? Run this query if you are not sure.
>
>
>
> *SELECT COUNT(*) FROM mysql.time_zone_name;*
>
>
>
> *If it returns 0 then you need to populate the them as per the
> instructions here
> http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html*
>
>
>
> Default timezone in mysql is set at server startup to SYSTEM, which means
> so long as your system clock is correct the MySQL server should be correct.
>
>
>
>
>
>
>
> On 3 June 2011 09:55, Rocio Gomez Escribano <
> r.go...@ingenia-soluciones.com> wrote:
>
> Hello! I’m having trouble with timezones.
>
>
>
> I’m in Spain, we have 2 different timezone now we are in GMT+2, in winter,
> this is the GMT+1.
>
>
>
> I’m looking for an instruction which give me the current timezone, but I
> cant find it! Do you know how can I now it?
>
>
>
> Thanks!
>
>
>
> *Rocío Gómez Escribano*
>
> r.go...@ingenia-soluciones.com <r.sanc...@ingenia-soluciones.com>
>
>
>
> *¡Error! Nombre de archivo no especificado.*
>
> Polígono Campollano C/F, nº21T
>
> 02007 Albacete (España)
>
> Tlf:967-504-513  Fax: 967-504-513
>
> www.ingenia-soluciones.com
>
>
>
>
>
>
> --
> John Daisley
>
> Certified MySQL 5 Database Administrator
> Certified MySQL 5 Developer
> Cognos BI Developer
>
> Telephone: +44 (0)7918 621621
> Email: john.dais...@butterflysystems.co.uk
>



-- 
John Daisley
Butterfly Information Systems

Microsoft SQL Server Database Administrator
Certified MySQL 5 Database Administrator & Developer
Cognos BI Developer \ Administrator

Available for short & long term contracts

Telephone: +44 (0)7918 621621
Email: john.dais...@butterflysystems.co.uk

Reply via email to