Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
How to convert a time of any country to a specific timezone's time?

Let's suppose my time in India is 9:30AM, so i want to convert this time to some other timezone of a different country.

Click here to see the image preview for this.

So, i hve this timeslots of 45 mins each of Asia/Calcuuta, and as you see someone has booked the first 2 time slots.

So, now as i as another user from Asia/Karachi try to book the time slot, first it overrides and interchanges the Asia/Calcutta time to Asia/Karachi, but the issue is that those 2 booked slots are show here as Avialable. I want that anyone from any timezone see the booked slots as well.

Click here to see the image preview for this.

  for(var i=0;i<slotsArray.length;i++)
  {
    for(var j=0;j<this.bookedTimingsOfUser.length;j++)
    {
    var getStartValInSlice = (this.bookedTimingsOfUser[j][0].userstartTime).slice(0, -3);
 
    if((momenttm(date+ " " + slotsArray[i].timeSlotStart).tz(timezone)).tz(this.bookedTimingsOfUser[j][0].userBookedTimezone).format('LT')  == momenttm(date+ " " + getStartValInSlice).tz(this.bookedTimingsOfUser[j][0].userBookedTimezone).format('LT') &&  moment(getDate.value).format('LL')  == this.bookedTimingsOfUser[j][0].userbookedDate)     

      slotsArray[i].timeSlotStart = "Booked";
     
    }
  }
}

How can i achive this using JS or any other time conversion npm packages like moments.js ???

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can pass timezone property to toLocaleString method to convert this time to different timezone

const timezoneSelect = document.querySelector('#timezones'),
  displayZone = document.querySelector('strong');

timezoneSelect.addEventListener('change', function(e) {
  const date = new Date().toLocaleTimeString('en-US', {
    timeZone: this.value
  });
  displayZone.innerText = date;
})
<select name="timezones" id="timezones">
  <option value="Asia/Kolkata">Asia/Kolkata</option>
  <option value="Asia/Karachi">Asia/Karachi</option>
</select>

<p>Current Time: <strong>HH:MM:SS</strong></p>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!