My web application requires 6 different cron jobs to run to update timezone sensitive data within tables at 00:01:00 of each timezone. I want to create rake tasks for each time zone. Can I configure rake tasks to be timezone aware? For e.g., can I do that following in a rake task:
namespace :db do
task :update_EST_records => :environment do
Time.zone = "Eastern Time (US & Canada)"
sql = "UPDATE QUERY GOES HERE WITH CREATED_AT BETWEEN ? AND ?"
ActiveRecord::Base.establish_connection
ActiveRecord::Base.connection.execute(sql,
Time.zone.now.beginning_of_day.utc,
Time.zone.now.end_of_day.utc)
end
end