<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
var thedate = new Date();
//alert(thedate.toLocaleString());
//alert(thedate);
//alert('LocaleString:'+thedate.toLocaleString());//将时间转换成本地的字符串表示
// alert('String:' + thedate.toString());
// alert('LocaleDateString:' + thedate.toLocaleDateString());
// alert('LocaleTimeString:' + thedate.toLocaleTimeString());
// alert(thedate.toTimeString());
alert('Date:' + thedate.getDate());
// alert('Day:' + thedate.getDay());
alert('Year:' + thedate.getFullYear());
//alert('当前日期为' + thedate.getFullYear(), thedate.getMonth(), thedate.getDate(), thedate.getHours() + '时' + thedate.getMinutes() + '分' + thedate.getSeconds() + '秒');
// alert('Milliseconds:' + thedate.getMilliseconds());
// alert('Minutes:' + thedate.getMinutes()+'分');
// alert('Month:' + (thedate.getMonth()+1));//如果用整数表示月份的话,0代表1月,1代表2月...11代表12月
//alert('Seconds:' + thedate.getSeconds()+'秒');
//var thedate = new Date(2012, 3, 7, 12, 11, 12,222);
// alert(thedate.toLocaleString());
// alert(thedate.getMilliseconds());
/*var thedate = new Date('2012, March, 7,12:11:22');
alert(thedate.toLocaleString());
alert(thedate.getMilliseconds());
alert(thedate.getYear()); //建议使用GetFullYear获取年*/
var thedate = new Date('2012, March, 7,12:11:22');
thedate.setFullYear(2013);
alert(thedate.toLocaleString());
alert(thedate.toLocaleString());
thedate.setFullYear(2013,3,8);
alert(thedate.toLocaleString());
thedate.setDate(1);
alert(thedate.toLocaleString());
thedate.setMonth(17);
alert(thedate.toLocaleString());
thedate.setDate(365);
thedate.setDate(32);
alert(thedate.toLocaleString());
</script>
</head>
<body>
</body>
</html>