LoginSignup
1
0

More than 3 years have passed since last update.

【10行】Javascriptで与えられた日の週の月曜を出す

Last updated at Posted at 2020-10-04

<html><body>
<script>

var date = new Date();
while(true) {
    if(date.getDay() == 1) break;
    date = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1);
}

document.write(date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate());

</script>
</body></html>
1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0