0

I have this query:

SELECT * 
FROM article 
WHERE online= 1 
AND IF(ISNULL(dateHOnline), dateHCreation, dateHOnline) <= Convert_TZ(Now(), "SYSTEM", "Europe/Paris")

But Convert_TZ(Now(),"SYSTEM","Europe/Paris") returns null, probably because my mysql server does not support timezone tables (putting +02:00 return a datetime).

So how can I modify that request (it's a VIEW) to implement the daylight saving feature in the comparison. I guess that just putting +02:00 instead of Europe/Paris would not be enough.

PS : I do not have control over the mysql engine

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Oliver
  • 23,072
  • 33
  • 138
  • 230

1 Answers1

0

What you need to do is to load timezone information into mysql.

mysql_tzinfo_to_sql tz_dir
Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78
  • That does not work as a SQL statement. Of course... ? PS : I do not have direct control over the mysql engine – Oliver Nov 30 '11 at 14:29
  • If you don't controll the server or can get someone to load this for you I think you have to rethink. Do date conversion in your application and store all dates in UTC. Never call now() but call utc_timestamp() instead. – Andreas Wederbrand Nov 30 '11 at 15:46