Skip to content

Instantly share code, notes, and snippets.

@shikumiya-hata
Created October 21, 2020 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shikumiya-hata/e0763ba107180f3caa9b153eeb039537 to your computer and use it in GitHub Desktop.
Save shikumiya-hata/e0763ba107180f3caa9b153eeb039537 to your computer and use it in GitHub Desktop.
// 1年半後を取得
var dt = new Date()
dt.setMonth(dt.getMonth() + 18)
// YYYY/MM/DDで出力
var ymd = dt.getFullYear() + '/' + (('0' + (dt.getMonth() + 1)).slice(-2)) + '/' + (('0' + dt.getDate()).slice(-2))
console.log(ymd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment