I have a table in my database which stores time zone information with country code. Now I want to update this table whenever Daylight saving time is applied for that country. Any Free API available for this? Or Any other kind of solution anyone knows.
1 Answers
Since the question has been updated to reflect SQL Server rather than MySQL, I'll point at this answer, which describes in part how to use either the AT TIME ZONE
statement, or my SQL Server Time Zone Support project.
Original answer below, when question was tagged as mysql
Don't keep your own tables. MySQL has support for time zones built-in within the CONVERT_TZ
function. Read here about how to keep MySQL updated.
You do not need to update the tables for every regular DST change. You only need to update them if the governments have decided the rules for DST or standard time have changed. The TZ Database tracks these sort of changes, and makes them available for operating systems, programming languages, databases, etc.
You should also read the timezone tag wiki. Especially the section "Time Zone != Offset"
. If you have a custom table that you feel like you need to update because of DST, then likely you have a table of offsets, not a table of time zones. This is a bad design, and you should just use the MySQL built-in stuff.

- 1
- 1

- 230,703
- 74
- 448
- 575
-
But what if we use sql server than mysql? – Shekhar Patel Nov 07 '16 at 07:00
-
See the updated answer above. Next time, please tag carefully, as answers often vary considerably across SQL implementations. Thanks. – Matt Johnson-Pint Nov 07 '16 at 17:34