0

I am writing a Node.js action in IBM Cloud Functions. How to get Japan time? I tried the following code at 6:28 AM Japan time but I got 9:28 PM.

Code:

console.log(new Date().toLocaleString({ timeZone: 'Asia/Tokyo' }))

Output:

"2021-10-12T21:28:43.740984Z    stdout: 10/12/2021, 9:28:43 PM"

I wonder if it was Sydney time because my namespace is in Sydney. However, It was 8:28 AM in Sydney, so I'm confusing.

mira
  • 265
  • 2
  • 11

1 Answers1

0

There was no first argument.

console.log(new Date().toLocaleString('ja-JP', { timeZone: 'Asia/Tokyo' }))
mira
  • 265
  • 2
  • 11