Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TimeZoneInfo vs. Olson database

Do TimeZoneInfo and Olson database use identical identificators for time zones?

I get timezone id from GeoNames service (which is based on Olson database) and want to retrieve day light saving information for that timezone.

like image 906
SiberianGuy Avatar asked Apr 12 '10 06:04

SiberianGuy


People also ask

What is my tz database?

The tz database is a collaborative compilation of information about the world's time zones, primarily intended for use with computer programs and operating systems. Paul Eggert is its current editor and maintainer, with the organizational backing of ICANN.

What are the 8 different time zones?

From east to west they are Atlantic Standard Time (AST), Eastern Standard Time (EST), Central Standard Time (CST), Mountain Standard Time (MST), Pacific Standard Time (PST), Alaskan Standard Time (AKST), Hawaii-Aleutian Standard Time (HST), Samoa standard time (UTC-11) and Chamorro Standard Time (UTC+10).

How is user timezone stored in database?

Rule 2: Use an Appropriate Data Type Oracle: Use the TIMESTAMP WITH TIME ZONE data type as this can store the timezone of UTC. SQL Server: Use the DATETIMEOFFSET data type, which can store the timezone of UTC. MySQL: Use the TIMESTAMP data type which can include a timezone component.

What is UTC tz?

What Is UTC? UTC—Coordinated Universal Time—is the 24-hour time standard used as a basis for civil time today. All time zones are defined by their offset from UTC. The offset is expressed as either UTC- or UTC+ and the number of hours and minutes.


2 Answers

The unicode consortium keeps a mapping between Olson database and Windows TimeZone Ids, which can be accessed here.

Also see this SO question and answers for more daylight savings info (Daylight saving time - do and don’ts).

like image 125
Oded Avatar answered Sep 17 '22 17:09

Oded


No they don't use the same identifiers. A possible solution is to use Noda-Time which foregoes TimeZoneInfo in favour of Olson timezones.

Further reading: What's wrong with DateTime anyway?

like image 38
Stephen Kennedy Avatar answered Sep 21 '22 17:09

Stephen Kennedy