Skip to content

Instantly share code, notes, and snippets.

@mscoutermarsh
Created October 21, 2012 18:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mscoutermarsh/3927973 to your computer and use it in GitHub Desktop.
Save mscoutermarsh/3927973 to your computer and use it in GitHub Desktop.
Send user email in their timezone
# Set zone to the users time zone
Time.zone = user.time_zone
# convert time to UTC
user_time_to_utc = Time.zone.parse('2012-10-22 09:25:00').utc
puts "Scheduling for #{user.login} at #{user_time_to_utc}"
# Schedule the sidekiq job
SendPromoEmail.perform_at(user_time_to_utc,user.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment