I want to get the client machine local time.
I have to covert a specific UTC time to user’s local time.
2/10/2019 12:00:00 AM –>> I have to convert this to user’s time
I want to back the time to user’s time.
Can tou please conver the time to user’s time
2
Answers
You can use either
getTimezoneOffset
ortoLocaleString
ortoLocaleDateString
.Hi you can use Date constructor of JS
if you want to get time for the current TimeZone you can use
or if you want to date according to some locale and time zone you can do something like this:
Can read more about Date and Intl on MDN docs
INTL -https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl
Date – https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
Hope it helps