Skip to content

Instantly share code, notes, and snippets.

@bondarewicz
Created October 24, 2024 14:51
Show Gist options
  • Save bondarewicz/41a5c8cad0b89f53bc30da36f2933fc3 to your computer and use it in GitHub Desktop.
Save bondarewicz/41a5c8cad0b89f53bc30da36f2933fc3 to your computer and use it in GitHub Desktop.
florida-timezones.cs
private static TimeZoneInfo GetTimeZoneForFloridaUsa(int postalCode)
{
var centralTimeList = new List<int>
{
32401, 32402, 32403, 32404, 32405, 32406, 32407, 32408, 32409, 32410, 32411, 32412, 32413, 32417, 32420,
32421, 32422, 32423, 32424, 32425, 32426, 32427, 32428, 32430, 32431, 32432, 32433, 32434, 32435, 32437,
32438, 32439, 32440, 32442, 32443, 32444, 32445, 32446, 32447, 32448, 32449, 32454, 32455, 32459, 32460,
32461, 32462, 32464, 32465, 32466, 32501, 32502, 32503, 32504, 32505, 32506, 32507, 32508, 32509, 32511,
32512, 32513, 32514, 32516, 32520, 32521, 32522, 32523, 32524, 32526, 32530, 32531, 32533, 32534, 32535,
32536, 32537, 32538, 32539, 32540, 32541, 32542, 32544, 32547, 32548, 32549, 32550, 32559, 32560, 32561,
32562, 32563, 32564, 32565, 32566, 32567, 32568, 32569, 32570, 32571, 32572, 32573, 32574, 32575, 32576,
32577, 32578, 32579, 32580, 32581, 32582, 32583, 32588, 32589, 32590, 32591, 32592, 32593, 32594, 32595,
32596, 32597, 32598
};
return postalCode is >= 32003 and <= 34997 ? TimeZoneInfo.FindSystemTimeZoneById(centralTimeList.Contains(postalCode) ? "America/Chicago" : "America/New_York") : default;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment