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

132
Vistas
Display Date in time zone specified in date string

I have this date coming as string from API

{
 "date": "2020-11-05T18:24:00-05:00"
}

I want this to be rendered as :

November 5, 2020, 6:24:00 PM EST

The issue is, I can't extract timezone name from this string to pass to Intl.DateTimeFormat()

Any thoughts?!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can't get EST from -05:00 directly, without defining a context. Indeed, this offset could reference several time zones, see this list.

In the browser, you can let the time library to guess the time zone of your client:

var tz = moment.tz.guess(); // America/New_York, for example
var date = moment("2020-11-05T18:24:00-05:00").tz(tz)
   .format("MMMM D, YYYY, h:mm:ss A z");
console.log(date);    // November 5, 2020, 6:24:00 PM EST

Or you can define a time zone yourself.

Of course, the two solutions will not give you the same result depending on the time zone specified.

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