Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda