How to get user specific time with specific time and date
P粉044526217
P粉044526217 2023-09-08 22:45:31
0
1
525

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粉044526217
P粉044526217

reply all(1)
P粉458725040

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});
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!