Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(year, month, day) {
- let thisDay = new Date(year, month -= 1, day += 1);
- let newYear = thisDay.getFullYear();
- let newMonth = thisDay.getMonth();
- let newDate = thisDay.getDate();
- console.log(`${newYear}-${newMonth + 1}-${newDate}`);
- }
- solve(2018, 2, 28);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement