So, to convert to local time which is easter time zone
def starts_today?
event.start_time <= Time.current.end_of_day.in_time_zone("Eastern Time (US & Canada)")
end
Question
Say I have a dispatch system running on eastern time, and it deals with events in multiple time zones. It has a method like:
def starts_today?
event.start_time <= Time.current.end_of_day
end
How would you set this up so the starts_today?
method is accurate to the event's local time zone?
Solution
So, to convert to local time which is easter time zone
def starts_today?
event.start_time <= Time.current.end_of_day.in_time_zone("Eastern Time (US & Canada)")
end
OTHER TIPS
You can use local time also
Time.now.getlocal.zone
Time.zone.name
If u want all time zone use this one
ActiveSupport::TimeZone.zones_map.values.collect{|z| z.name}.compact
http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html