To take account of daylight savings time in MySQL, load the time zone tables and set the `default_time_zone` variable to the named time zone for your country.
On 3 June 2011 11:37, Johan De Meersman <vegiv...@tuxera.be> wrote: > I would also like to point out, as an aside, that Spain doesn't actually > have two timezones - it has a single timezone with daylight savings time. > The real question is, thus, to figure out wether or not you are on DST or > not. > > That, however, I have no idea how to do - the system takes care of it > automagically. I'm not even sure it gets tracked somewhere on the system, > you might need to download and parse the rules yourself in your code. > > Unless, of course, you're talking about the timezone difference between > Spain and the Canaries, but you mentioned summer/winter time explicitly, so > I don't think so. > > > ------------------------------ > > *From: *"John Daisley" <daisleyj...@googlemail.com> > *To: *"Rocio Gomez Escribano" <r.go...@ingenia-soluciones.com> > *Cc: *mysql@lists.mysql.com > *Sent: *Friday, 3 June, 2011 12:08:34 PM > *Subject: *Re: timezone > > > 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: > > > > > > -- > Bier met grenadyn > Is als mosterd by den wyn > Sy die't drinkt, is eene kwezel > Hy die't drinkt, is ras een ezel > -- 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