I’m storing timezones in my database that I get via FB’s api. The timezone looks like:
-7
What field should I be using in rails/PostgreSQL to store this value? String?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your timezone is always going to be an offset then use a
:decimal(don’t forget about places like Newfoundland Canada that are at UTC−3.5). Generally, timezones come in many different forms:So your safest bet would be a
:string. The Olson Database is a good place to get an idea of the various timezone formats you’ll come across.