How to enforce the cron job to run on PST time in rails?

925 Views Asked by At

I want to schedule a cron Job to run on 5 AM PST to 8 PM PST? I just want to know how to enforce my job to be run on PST?. I am new to this cron Job.

// code

cron: "0 5-20 * * *"
1

There are 1 best solutions below

0
Vishal On BEST ANSWER

You can give timezone to cron by below way.

"0 5-20 * * * America/Los_Angeles"

If you are not sure which timezone will it come just fetch records of timezones of rails with this command ActiveSupport::TimeZone.all and select TZInfo::DataTimezone.