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

391
Vistas
How to get current date and time of user laptop not server in angular?

I have deployed the angular app on the server, but I want to get my system (laptop) date and time in the application.
Suppose the server has the date and time of timeZoneA while my laptop has date and time of TimeZoneB, so basically, I want that timeZoneB should be shown in the application opened in the browser of my laptop.

this.currentDateTime = new Date();

I can get date and time of any specific zone. but it's not requirement.

formatDate(new Date(),'dd-MM-yyyy hh:mm:ss a','en-US','+0500');
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

In the question you are passing the timezone in formatDate so that is why you are getting the specific timezone date.

Remove the timezone from formatDate to the local date and time.

change :

formatDate(new Date(), 'dd-MM-yyyy hh:mm:ss a','en-US','+0500');

to :

date = formatDate(new Date(), 'dd-MM-yyyy hh:mm:ss a', 'en-US');

If you want to get the time of specific time zone :

function getTime(){
    //timeZone can be  "CST","GMT" ,"Asia/Jerusalem" , etc
    var d = new Date(new Date().toLocaleString("en-US", {timeZone: "CST"}));
    var n = d.toLocaleString(); // just to get date & time
    return n;
}
over 4 years ago · Santiago Trujillo 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