Skip to content

Instantly share code, notes, and snippets.

@ktkaushik
Created January 8, 2013 13:54
Show Gist options
  • Select an option

  • Save ktkaushik/4483985 to your computer and use it in GitHub Desktop.

Select an option

Save ktkaushik/4483985 to your computer and use it in GitHub Desktop.
add time in time zone
Activity.all.each do |activity|
begin
puts activity.id
if (tz=activity.get_value_from_info('timezone'))
if Time.find_zone(tz)
activity.activity_time_with_zone = DateTime.strptime(activity.activity_time.in_time_zone( tz ).strftime("%m/%d/%Y %H:%M:%S"), "%m/%d/%Y %H:%M:%S")
activity.save!
end
end
rescue Exception => e
puts e
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment