Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I get a simple table of time zones for use in SQL server? [closed]

I just need to make a SQL table of time zones - at this point, my only need is to populate a drop-down list on an online form. I'm envisioning something simple with columns for ISO code, name, UTC offset, and perhaps a list of representative cities. I thought I would be able to easily find something online to copy-and-paste, but haven't been able to locate anything.

I was directed by this question to the tz database, which is in binary form and seems like overkill for what I need. Alternatively I could piece this together from sites like TimeAndDate.com, but that seems like more work than should be necessary.

Or am I going about this the wrong way - e.g. should I be getting this information from the server's OS?

like image 953
Herb Caudill Avatar asked Oct 15 '09 11:10

Herb Caudill


People also ask

How do I find the time zone in SQL Server?

SQL Server SYSDATETIMEOFFSET() function overview The SYSDATETIMEOFFSET() function returns a value of DATETIMEOFFSET(7) that represents the current system date and time, which also includes the time zone, of the computer on which the SQL Server instance is running.

Does SQL Server store timezone?

How to Convert UTC to Local Time Zone in SQL Server in SQL Server. SQL Server does not store time zone data when storing timestamps. It uses the host server time as the basis for generating the output of getdate() .

How do I set SQL time zone?

Option 2: Edit the MySQL Configuration File Scroll down to the [mysqld] section, and find the default-time-zone = "+00:00" line. Change the +00:00 value to the GMT value for the time zone you want. Save the file and exit. In the example below we set the MySQL Server time zone to +08:00 (GMT +8).

How do I get UTC offset in SQL Server?

Use DATEPART with TZ parameter. Example : SELECT DATEPART(tz, (CAST('2021-01-01' AS DATETIMEOFFSET) AT TIME ZONE 'Central European Standard Time'));


1 Answers

the list of all timezone are here:

select * from sys.time_zone_info

Enjoy!

like image 132
Nelson Gomes Matias Avatar answered Nov 15 '22 23:11

Nelson Gomes Matias