How to create a table/database/reference guide

I've been all over the internet trying to find away to get the time zone from lat and long. The only way to do it is to use an outside website. So I found and excel spread sheet that list all the US zip codes and their time zones. So my questions is how to make a table/database/reference guide that when I get the zip code it'll look at my table/database/reference guide to see what time zone that zip code is in. The zip code would be entered by the user on their phone and the app I built will send the zip code to the Arduino via blue-tooth. I already have the connection between Arduino and the phone just need away to get the time zone.

Any help is always appreciated!!!

Thank you

Tricky. There are over 42000 five digit zip codes in the US and they can start with a nine. That means you would need 17 bits to store one and another four bits to specify which of the nine time zones it's in. That's a little over 107K of data. The Mega has enough progmem to store it but why use an arduino for the job? Keep the data on your phone.

zones. So my questions is how to make a table/database/reference guide that when I get the zip code it'll look at my table/database/reference guide to see what time zone that zip code is in.

What size is your data table?

Are you talking about this one I can find by using Google, possibly:
The ZIP code database contained in 'zipcode.csv' contains 43204 ZIP codes for the continental United States, Alaska, Hawaii, Puerto Rico, and American Samoa. The database is in comma separated value format, with columns for ZIP code, city, state, latitude, longitude, timezone (offset from GMT)

I'm afraid, you have to use a SD card module to put the data on it and then read it from SD card by the help of your Arduino.

Too much data for putting it into an array in RAM or even PROGMEM.

OTOH whole ranges of zip codes can be found in different US time zones so you won't have to store them all.

If you store on SD however the zip codes may calculate to an index into a file where the matching time zone is stored. It's not real hard to connect SD to Arduino.

43204, 3 bytes to hold zip code + time zone, = 129612 bytes
Plus lat/long of the center of the zip code? xx.xx/xx.xx to xx.xx/xxx.xx for points farther west.
Maybe skip the time zone then and just go with center of counties in a state, maybe less data that way.
Looking like SD card will be the way to go, or some external memory (FRAM for example).

You shouldn't need to list ALL the zip codes, it is a system. There is more rule than exception.

What do the digits indicate?

The first number indicates a ZIP code zone. Here’s a look at the 9 zones:


States in ZIP code zone
0 Connecticut, Massachusetts, Maine, New Hampshire, New Jersey, Puerto Rico, Rhode Island, Vermont, Virgin Islands
1 Delaware, New York, Pennsylvania
2 District of Columbia, Maryland, North Carolina, South Carolina, Virginia, West Virginia
3 Alabama, Florida, Georgia, Mississippi, Tennessee
4 Indiana, Kentucky, Michigan, Ohio
5 Iowa, Minnesota, Montana, North Dakota, South Dakota, Wisconsin
6 Illinois, Kansas, Missouri, Nebraska
7 Arkansas, Louisiana, Oklahoma, Texas
8 Arizona, Colorado, Idaho, New Mexico, Nevada, Utah, Wyoming
9 Alaska, American Samoa, California, Guam, Hawaii, Marshall Islands, Federated States of Micronesia, Northern Mariana Islands, Oregon, Palau, Washington

The first three digits of the ZIP code indicate the sectional center facility (SCF) or a central mail processing facility that serves one or more three-digit ZIP codes. There are sectional center facilities all over the United States.

For example, if a ZIP code starts with a 7, you know it’s going to one of four states: Louisiana, Arkansas, Oklahoma, or Texas. Then, the second two numbers will tell you what state. If it’s between 716 and 729, then you know it’s going to be in Arkansas. So 716 would be connected with Pine Bluff, AR.

The last two digits in a ZIP code are how the mail is actually sorted to specific postal offices. The “plus-four” add-on codes that were launched in 1983 are supposed to identify a specific geographic location within the five-digit area. Although the full nine-digit ZIP codes are not required in order to send mail, they are increasing in everyday use.
The Bottom Line

The ZIP code is not just a randomly generated number. There is meaning and organization behind it, which is why it’s a system that’s lasted more than 50 years.

Good Little Programmers always look for patterns in the data.