Advertisement
Pijomir

Previous Day

Jan 11th, 2024
840
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getdate(year, month, day) {
  2.     let date = new Date(year, month - 1, day);
  3.     date.setDate(date.getDate() - 1);
  4.     let theYear = date.getFullYear();
  5.     let theMonth = date.getMonth() + 1;
  6.     let theDay = date.getDate();
  7.     console.log(theYear + '-' + theMonth + '-' + theDay);
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement