Tutorial :Rails app - how to enter events in local time zone


I am working on a Rails app that displays a sports schedule (in a basic table). Each game/event is a db table row. The customer wants all the events to display in chronological order but to also display the time in the event's local timezone.

How can I add a timezone selector to the New action? So that when the customer enters events they can select the event's timezone and input the event's time in that timezone.

Here is what the schedule would look like:

Event 1 7:00 pm EST Event 2 5:00 pm PST Event 3 7:00 pm PST

I personally think this is confusing, but it's what they want. Thanks in advance.


Geoff Buesing wrote a great primer on Rails support of time zones back when 2.1 was released.


Okay I am not so sure I understood your question directly but here is my line of thinking there is a library I passed along called tzinfo which is supposed to give Rails the ability to work with timezones so my guess is do the following build a list for a select box (wikipedia has a good complete list) when the user selects the timezone send it to the server which will calculate the appropriate timings now and send back (maybe depending on your architecture you could send only the added hours that should be added or subtracted)

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »