最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

js獲得當前系統(tǒng)日期時間的方法

 更新時間:2015年05月06日 17:36:36   作者:lrwins  
這篇文章主要介紹了js獲得當前系統(tǒng)日期時間的方法,涉及javascript操作日期時間的相關(guān)技巧,非常簡單實用,需要的朋友可以參考下

本文實例講述了js獲得當前系統(tǒng)日期時間的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js時間顯示</title>
<script>
var curr_time = new Date();
var strDate = curr_time.getYear()+"年";
strDate += curr_time.getMonth()+1+"月";
strDate += curr_time.getDate()+"日";
strDate += curr_time.getHours()+":";
strDate += curr_time.getMinutes()+":";
strDate += curr_time.getSeconds();
document.write(strDate);

var curr_time = new Date();
with(curr_time)
{
//定義變量,并為其賦值為當前年份,后加中文“年”字標識
var strDate = getYear()+1900+"年";
//取當前月份。注意月份從0開始,所以需加1,后加中文“月”字標識
strDate +=getMonth()+1+"月";
strDate +=getDate()+"日"; //取當前日期,后加中文“日”字標識
strDate +=getHours()+":"; //取當前小時
strDate +=getMinutes()+":"; //取當前分鐘
strDate +=getSeconds(); //取當前秒數(shù)
alert(strDate); //結(jié)果輸出
}
</script>
</head>
<body>
</body>
</html>

希望本文所述對大家的javascript程序設(shè)計有所幫助。

相關(guān)文章

最新評論

闻喜县| 海伦市| 乌鲁木齐市| 永善县| 米易县| 潼关县| 连江县| 江永县| 漳平市| 彭山县| 海宁市| 交口县| 南宫市| 永丰县| 玉门市| 杭州市| 都江堰市| 游戏| 五家渠市| 阿瓦提县| 奎屯市| 安吉县| 新泰市| 潍坊市| 通道| 宁化县| 南雄市| 桦川县| 唐河县| 米林县| 广州市| 曲沃县| 孟连| 南部县| 广元市| 石台县| 南昌市| 安康市| 宿迁市| 宁晋县| 玉山县|