javascript

日期:

<script language="JavaScript" type="text/javascript">

var myDate = new Date();

var year = myDate.getYear();

var month = myDate.getMonth();

var date = myDate.getDate()//day 是星期。date是每天。

document.write(""+year+""+month+""+date);

var hour = myDate.getHour();

var minutes = myDate.getMinute();

var seconds = myDate.getSeconds();

if(hour>12){

var sString ="PM";

}else{

var sString ="AM";

}

document.write("");

</script>

本文出自 “Oracle学习个人见解” 博客,转载请与作者联系!

你可能感兴趣的:(js,练习)