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

146
Views
¿Cómo agrego un desplazamiento UTC de la hora local?

Este es el código, estoy tratando de hacer una pantalla HTML para UTC+8 pero estoy en ITC

 setInterval(function(){ var dt = new Date(); document.getElementById("datetime").innerHTML = dt.toLocaleTimeString(); }, 1000);
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Esto debería ser lo que estás buscando:

 var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit'}; function getUTCDate(offset) { var Now = new Date(); var UTCDate = new Date(Now.getTime() + Now.getTimezoneOffset() * 60000);; // UTC Date // Get difference in Timezone (offset => to Difference) var tzDifference = UTCDate.getTimezoneOffset() + (offset * 60 * 60); var offsetTime = new Date(UTCDate.getTime() + (offset * 60 * 60) * 1000); return (offsetTime.toLocaleDateString("en-EN", options) + " (UTC" + (offset > 0 ? "+" : "") + (offset != 0 ? offset : "") + ")") } setInterval(function () { document.getElementById("datetime").innerHTML = getUTCDate(+8); }, 1000);
about 4 years ago · Juan Pablo Isaza Report

0

puede usar el método toUTCString.

 var dt = new Date(); document.getElementById("datetime").innerHTML = dt.toUTCString();
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!