0

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.

Shekhar Patel
  • 641
  • 10
  • 20

1 Answers1

1

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

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.

Community
  • 1
  • 1
Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575