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

151
Views
Calendar date is displaying one day ahead

This is setup on CodePen and is written with JavaScriptand HTML. How can I correct the code so that there is just one dateTime var and it shows today's calendar date? https://codepen.io/Artomic/pen/LYLXWpb

        const currentDate = new Date();
        const dateTime = currentDate.getDate() + "/" +
         (currentDate.getMonth() + 1) + "/" +
         currentDate.getFullYear() + " " +
         currentDate.getHours() + ":" +
         currentDate.getMinutes()
        
        
        var months = ['January','February','March','April','May','June','July',
       'August','September','October','November','December'];       
        var tomorrow = new Date();
        tomorrow.setTime(tomorrow.getTime() + (1000*3600*24));       
        document.getElementById("spanDate").innerHTML = months[tomorrow.getMonth()] + " " + 
        tomorrow.getDate()+ ", " + tomorrow.getFullYear();
        
        
        const dateTimeB = new Date().toLocaleTimeString('en-US', {
        hour12: false,
        hour: "numeric",
        minute: "numeric"
        });
        console.log(dateTimeB)
        
        document.getElementById("dateTimeB").innerHTML=dateTimeB
        
        HTML
        
        <span id="spanDate"></span> 
        <br>
        <span id= "dateTimeB"</span>
        
        <span id="dateTime"></span>
         
about 4 years ago · Juan Pablo Isaza
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!