I have to write some cron expressions from a firebase schedule function. As Google's servers aren't in the same timezone as me I will have to convert my existing expressions.
(from UTC 2 to UTC-5).
Here is an example of one of my expressions:
0 9-17 * * 1-5
- from monday to friday at minute 0 from 9:00 to 17:00
How can I convert this so it will run at this time in UTC 2 when the server is in UTC-5
CodePudding user response:
Because UTC 2 to UTC-5 is 7 hours backwards you should take the time 7 hours backwards:
0 2-10 * * 1-5
CodePudding user response:
When we look at the Firebase Schedule Function documentation found documented here:
https://firebase.google.com/docs/functions/schedule-functions
we find a section called Write a scheduled function. In there we find that when we code:
functions.pubsub.schedule("<CRON String">)
we can add a timeZone
setting. For example:
functions.pubsub.schedule("<CRON String">).timeZone('America/New_York')
What this means to us is that we can set a specific time zone against which our CRON intervals will be evaluated. According to the documentation, the default time zone is utc
.