How do I get the time of day in javascript/Node.js?

后端 未结 9 848
青春惊慌失措
青春惊慌失措 2020-12-23 13:23

I want to get 1 to 24, 1 being 1am Pacific Time.

How can I get that number in Node.JS?

I want to know what time it is in Pacific time right

9条回答
  •  无人及你
    2020-12-23 13:40

    There's native method to work with date

    const date = new Date();
    let hours = date.getHours();
    

提交回复
热议问题