How to support datetime comparison in a query on a server that does not support timezone tables

75 Views Asked by At

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

1

There are 1 best solutions below

2
On

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

mysql_tzinfo_to_sql tz_dir