获取系统当前时间 年月日

来源:互联网 发布:ubuntu自启动程序 编辑:程序博客网 时间:2024/06/05 00:26
1
2
3
4
5
6
7
8
9
<script type="text/javascript">
    //得到当前时间yyyy-MM-dd
    var myDate = new Date();
    var nowDate = myDate.getFullYear();
    nowDate = nowDate + ((myDate.getMonth() + 1) < 10 ? "-0" + (myDate.getMonth() + 1) : "-" + (myDate.getMonth() + 1));
    nowDate = nowDate + (myDate.getDate() < 10 ? "-0" + myDate.getDate() : "-" + myDate.getDate());
     alert(nowDate);
</script>
原创粉丝点击