javascriptで現在の時間を印刷して構想とコードを実現します.

2145 ワード

 
  


<br/> <br/><script> <br> <br>/* <br> <br>// <br>var date = new Date(); <br>alert(date);// <br>alert(date.toLocaleString());// <br>alert(date.getFullYear());// <br>alert(date.getMonth() + 1);// 0-11, 1 <br>alert(date.getDate());// <br>alert(date.getDay());// , <br>alert(date.getHours());// <br>alert(date.getMinutes());// <br>alert(date.getSeconds());// <br>alert(date.getMilliseconds());// <br>alert(date.getTime());// 1970 1 1 , <br>*/ <br>// 、 、 、 、 、 <br>var myDate = new Date(); <br>var year = myDate.getFullYear(); <br>var month = myDate.getMonth() + 1; <br>var date = myDate.getDate(); <br>var hours = myDate.getHours(); <br>var minutes = myDate.getMinutes(); <br>var seconds = myDate.getSeconds(); <br> <br>// 09 <br>if(month < 10 ){ <br>month = "0" + month; <br>} <br>if(date < 10 ){ <br>date = "0" + date; <br>} <br> <br>// <br>var dateTime = year + " " + month + " " + date + " " + hours + " " + minutes + " " + seconds + " "; <br> <br>document.write(dateTime);// <br> <br> <br> <br></script> <br/> <br/> <br/> <br/> <br/><!-- --> <br/><input type="button" value="click" onclick="show()"/> <br/> <br/> <br/> <br/> </code></pre> <div class="clearfix"> <span id="art_bot" class="jbTestPos"/> </div> </div> </div> </div>