「JavaScript」getYear()で現在の年を取得サンプル

2019年4月16日

サンプルコード1

var tt= new Date();
document.write(1900 + tt.getYear() + "年" + (tt.getMonth() + 1) + "月" + tt.getDate() + "日");

サンプルコード2

var d = new Date()
document.write(d.getYear())

JavaScript

Posted by arkgame