AirportInfoStruct - timezone field


#1

Just want to make sure I understand the timezone field:

ex: KATL

CST5CDT

CST is the normal time observed
5 is the normal offset (-5 hours) from UTC
CDT indicates that DST is observed

Does this look the same when we are observing DST?

ex: KPHX

MST7

Always MST since they don’t observe DST
UTC offset is always -7

There are some places outside the US with a UTC offset that is not a whole hour, i.e. -3:30. Do you provide info for any of these airports, and what does the timezone field look like in this case?

Just looking for a consistent pattern so I know how to parse it.

Thanks,

Jack


#2

The timezone values can be in any of the formats supported by the POSIX libc “TZ” format. This GNU glibc manual page describes the full syntax.

gnu.org/s/libc/manual/html_n … iable.html

Generally only the (standardname)(offset)(daylightname) is used by us.

However some of our airports do use the “third format” described on that manual page, which is something like “:America/New_York” – en.wikipedia.org/wiki/Tz_database

If possible, I would recommend not trying to rewrite a parser for these various formats and simply pass the value to the timezone argument supported by your programming language. These formats are pretty widely supported by most environments, or you can probably find a library if not.

What programming language/environment are you using?


#3

.Net/C#


#4

There may be an open source or third-party library that accepts a POSIX/UNIX style TZ designator and returns a TimeZoneInfo object from it, however I don’t see one in my quick searches.

Otherwise, you indeed may need to roll your own using TimeZoneInfo.CreateCustomTimeZone():
msdn.microsoft.com/en-us/library/bb396326.aspx

I’ll keep looking and see if I find something third-party already written…


#5

Thanks, I appreciate the info.


#6

Hi waxinjaxin, I think you might be able to use one of these packages:

Let me know if they work out for you.


#7

Thanks, I actually ended up rolling my own solution.