返回/设置年份方法
注意:
1.结果格式依次为:星期、月、日、年、时、分、秒、时区。(火狐浏览器)
2. 不同浏览器,时间格式有差异。
2015-01-13
<script type="text/javascript">
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
var week = date.getDay();
var hour=date .getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
var tzone = date.getTimezoneOffset();//落后于UTC标准时区 是正值 领先是为负值
document.write("星期" + week+"."+ + month + "月" + day + "日" +month+ "月"+ year+ "年"+hour+ "时"+min+ "分"+sec+ "秒"+"UTC"+(tzone/60)+ "时区" );
</script>
<script type="text/javascript">
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
var week = date.getDay();
var hour=date .getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
var tzone = date.getTimezoneOffset();//落后于UTC标准时区 是正值 领先是为负值
document.write("星期" + week+"."+ + month + "月" + day + "日" +month+ "月"+ year+ "年"+hour+ "时"+min+ "分"+sec+ "秒"+"UTC"+(tzone/60)+ "时区" );
</script>
举报