简体   繁体   English

通过使用节点调度(Node.js)在 javascript 中应用服务器时区来运行后台服务。

[英]Running a backround service by applying server Timezone in javascript using node-schedule (Node.js.)

Hello stack overflow community,你好堆栈溢出社区,

I am an absolute beginner with regard to how servers configuration works.对于服务器配置的工作方式,我绝对是初学者。 Currently, I have an app to be scheduled at a specific time, for every 5 minutes.目前,我有一个应用程序要在特定时间安排一次,每 5 分钟一次。 (8:00 am - 10:00PM Malaysia Time, (GMT+8)). (马来西亚时间上午 8:00 - 晚上 10:00,(GMT+8))。 But my server is using Eastern Daylight Time, (EDT).但是我的服务器使用的是东部夏令时间(EDT)。

So how do I write it in my program so it will run on the 8-9 PM Malaysia time.那么如何在我的程序中编写它,以便它在马来西亚时间晚上 8 点到 9 点运行。

Below is my current code.以下是我当前的代码。

var schedule = require("node-schedule");

schedule.scheduleJob("*/5 8-22 * * *", function () {
//Some code to get data
  });

Thanks for any helps in advance感谢您提前提供任何帮助

Your server is Eastern Daylight Time, (EDT) equal to GMT-4 and you want to run your code at 8:00 GMT+8您的服务器是东部夏令时间 (EDT)等于GMT-4并且您希望在8:00 GMT+8运行您的代码

Then it would be from 8 PM (20:00) the day BEFORE to 10 AM CURRENT DAY in EDT time.然后是从前一天晚上 8 点(20:00)到美国东部时间当前日期上午 10 点

For this case, maybe you would like to see this cronjob over midnight .对于这种情况,也许您希望在午夜看到这个 cronjob Good luck.祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM