Ruby-on-rails – Use the Rails Society Time Zone in PostgreSQL – the field type to use

I store the time zone in the database I obtained through the FB API. The time zone looks like:

-7 

Which field should I use in rails/PostgreSQL to store this value? string?

If your time zone is always offset, use: decimal (don’t forget the These places are UTC-3.5). Usually, time zone has many different forms:

UTC-3.5
-7
America/Vancouver

So your safest bet is: strings. Olson Database is a good place to learn about the various time zone formats you will encounter.

I store the time zone in the database I get through the FB API. The time zone looks like:

-7

I should be in Which field is used in rails/PostgreSQL to store this value? string?

If your time zone is always offset, then use: decimal (don’t forget that these places in Newfoundland, Canada are UTC-3.5). Usually, the time zone has Many different forms:

UTC-3.5
-7
America/Vancouver

So you are the safest The bet is: strings. Olson Database is a good place to learn about the various time zone formats you will encounter.

Leave a Comment

Your email address will not be published.