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

223
Views
how do I get only the day displayed?

I am absolutely new and have not found a suitable answer yet (or was too blind to see it). I would like the date to be displayed to me in dd/mm/yyyy format. Currently it shows me the day in milliseconds though? Can someone help me?

var oneweekago = new Date();
var month = oneweekago.getMonth() +1
var day = oneweekago.setDate(oneweekago.getDate() - 7)
var year = oneweekago.getFullYear()
document.write(day + "/" + month + "/" + year)

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

This piece of code displays last's week date

<script>
const today = new Date()
const yesterday = new Date(today)

yesterday.setDate(yesterday.getDate() - 7)

today.toDateString()
yesterday.toDateString()
console.log(yesterday)
</script>
about 4 years ago · Juan Pablo Isaza Report

0

I believe you are looking for oneWeekAgo.toLocaleDateString()

var oneWeekAgo = new Date();
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7)
document.write(oneWeekAgo.toLocaleDateString())
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!