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

275
Views
I have the following code about the current date and time so, how do I add day in current time?
<script>
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();    
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' '+time;
</script>
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Try this:

tomorrow = new Date(today.getTime() + 1000 * 60 * 60 * 24)

One day equals 24h = 24 * 60 minutes = 24 * 60 * 60 seconds = 24 * 60 * 60 * 1000 miliseconds

Edit: I might have misunderstood the question, but if what you want to achieve is adding 1 day to your variable, this will work. 😄

over 4 years ago · Santiago Trujillo Report

0

You can use toLocaleString() Date method to get that format

let actualDate = new Date().toLocaleString();           // Output: d/m/yyyy h:mm:ss
console.log(actualDate)

over 4 years ago · Santiago Trujillo Report

0

If you’re looking for the day of the week, then today.getDay() will return a numerical day of the week from 0-6. You could then use an array with the day names in to refer to the text for the day of the week.

For example:

var days = [“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”];

var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+’-‘+today.getDate()+’-‘+days[today.getDay()];
over 4 years ago · Santiago Trujillo 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!