I have created a web application in which I'm using sails.js framework and mongodb for back-end purpose. I want to implement a cron job running at midnight of each day so that I can calculate previous day's power consumption of a property. This data has to be used for reporting purpose.
The cron job has to run w.r.t properties location, i.e, if 2 properties are located at different time zones, I have to run the job when midnight occurs for each time zone.
Asked
Active
Viewed 249 times
0

Chetanraj
- 19
- 3
-
So you have to set your cron job to run at specific local time that is midnight in other timezone. I don't think current cron implementations handles time-zones for you. – Puchacz Mar 20 '17 at 07:30
-
@Puchacz Exactly. Is there an module or package to do so. I can resolve this for single time-zone, but the problem arises when the clients are in multiple time-zones. – Chetanraj Mar 21 '17 at 17:28
-
can't you run 2 cron expressions for specific timezones separately? One for T.Z A and second for T.Z B? – Puchacz Mar 21 '17 at 20:37
-
@Puchacz no,it's about just 2 time-zones... if the clients are in more than 3 or 4 TZs, I have trigger the job jobs based on them. – Chetanraj Mar 22 '17 at 06:06