Home  >  Q&A  >  body text

How to get user specific time with specific time and date

I want to get the local time of the client computer.

I have to convert a specific UTC time to the user's local time.

2/10/2019 12:00:00 AM -->> I have to convert it to user's time

I want to restore the time to the user's time. Could you please convert the time to the user's time

P粉044526217P粉044526217376 days ago535

reply all(1)I'll reply

  • P粉458725040

    P粉4587250402023-09-09 18:53:52

    You can use getTimezoneOffset or toLocaleString or toLocaleDateString.

    const d = new Date('2/10/2019 12:00:00 AM');
    const clientDate = d.toLocaleString();
    const offset = d.getTimezoneOffset(); // offset in minutes
    console.log({clientDate, offset});

    reply
    0
  • Cancelreply