Answers for "how to convert time to users timezone in react"

0

timezone in react js

<select value={this.state.timezone} onChange={this.onSelect}>
           {Timezones.map((timezone) => <option value={timezone.value}>{timezone.name}</option>)}
</select>
Posted by: Guest on November-10-2020
0

how to convert time to users timezone in react

const dateToTime = date => date.toLocaleString('en-US', {
  hour: 'numeric',
  minute: 'numeric'
});

const dateString = "2019-05-05T10:30:00Z";
const userOffset = new Date().getTimezoneOffset()*60*1000;
const localDate = new Date(dateString);
const utcDate = new Date(localDate.getTime() + userOffset);

console.log(`${dateToTime(utcDate)} (${dateToTime(localDate)} Your Time)`);
Posted by: Guest on September-26-2021
0

timezone in react js

<select value={this.state.timezone} onChange={this.onSelect}>
           {Timezones.map((timezone) => <option value={timezone.value}>{timezone.name}</option>)}
</select>
Posted by: Guest on November-10-2020
0

how to convert time to users timezone in react

const dateToTime = date => date.toLocaleString('en-US', {
  hour: 'numeric',
  minute: 'numeric'
});

const dateString = "2019-05-05T10:30:00Z";
const userOffset = new Date().getTimezoneOffset()*60*1000;
const localDate = new Date(dateString);
const utcDate = new Date(localDate.getTime() + userOffset);

console.log(`${dateToTime(utcDate)} (${dateToTime(localDate)} Your Time)`);
Posted by: Guest on September-26-2021

Code answers related to "how to convert time to users timezone in react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language