您的位置:首页 > 其它

关于Date对象的使用

2015-10-10 10:59 302 查看
代码示例如下;
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus?">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Date对象</title>
</head>
<body>
<script type="text/javascript">
<!--
/*
Date对象:1.拿到当前时间:new Date() ;
2.拿到年月日,时分秒: getXXX() ;
*/

var d = new Date() ;
alert(d.toLocaleString()) ;
alert(d.getYear()) ;
alert(d.getMonth());  //老外是从0 开始
alert(d.getDate()) ;
alert(d.getDay()) ;
//-->
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: