用java编写一个时钟程序
3个回答
展开全部
<html>
<head>
<title>对象Date应用示例</title>
</head>
<body>
<script language="javascript" type="text/javascript">
var oNow=new Date();
var sDays=["日","一","二","三","四","五","六"];
sDate=oNow.getYear()+"年"+
(oNow.getMonth()+1)+"月"+oNow.getDate()+
"日 星期"+sDays[oNow.getDay()]+" "+
oNow.getHours()+":"+oNow.getMinutes()+
":"+oNow.getSeconds()+"."+oNow.getMilliseconds();
var oDate=new Date(2013,0,1,0);
var iInterval=oDate.getTime()-oNow.getTime();
var iDays=Math.floor(iInterval/(24*60*60*1000));
var iHours=Math.floor((iInterval/(24*60*60*1000)-iDays)*24);
var iMins=Math.floor(((iInterval/(24*60*60*1000)-iDays)*24-iHours)*60);
var iSecs=Math.floor((((iInterval/(24*60*60*1000)-iDays)*24-iHours)*60-iMins)*60);
document.writeln("将2013年1月1日转换毫秒数为:"+oDate.getTime()+"<br>");
document.writeln("<p>离元旦还有:".bold().fontcolor("red")+(iDays+"天"+iHours+
"小时"+iMins+"分"+iSecs+"秒").bold().fontcolor("green")+"</p>");
var oNow=new Date();
var sDays=["日","一","二","三","四","五","六"];sDate=oNow.getYear()+"年"+
(oNow.getMonth()+1)+"月"+oNow.getDate()+
"日 星期"+sDays[oNow.getDay()]+" "+
oNow.getHours()+":"+oNow.getMinutes()+
":"+oNow.getSeconds()+"."+oNow.getMilliseconds();
var oDate=new Date(2012,11,24,0);
var iInterval=oDate.getTime()-oNow.getTime();
var iDays=Math.floor(iInterval/(24*60*60*1000));
var iHours=Math.floor((iInterval/(24*60*60*1000)-iDays)*24);
var iMins=Math.floor(((iInterval/(24*60*60*1000)-iDays)*24-iHours)*60);
var iSecs=Math.floor((((iInterval/(24*60*60*1000)-iDays)*24-iHours)*60-iMins)*60);
document.writeln("将2012年12月24日转换毫秒数为:"+oDate.getTime()+"<br>");
document.writeln("<p>离平安夜还有:".bold().fontcolor("blue")+(iDays+"天"+iHours+
"小时"+iMins+"分"+iSecs+"秒").bold().fontcolor("green")+"</p>");
</script>
</body>
</html>
这是我做的一个倒计时,你可以根据这个编写
<head>
<title>对象Date应用示例</title>
</head>
<body>
<script language="javascript" type="text/javascript">
var oNow=new Date();
var sDays=["日","一","二","三","四","五","六"];
sDate=oNow.getYear()+"年"+
(oNow.getMonth()+1)+"月"+oNow.getDate()+
"日 星期"+sDays[oNow.getDay()]+" "+
oNow.getHours()+":"+oNow.getMinutes()+
":"+oNow.getSeconds()+"."+oNow.getMilliseconds();
var oDate=new Date(2013,0,1,0);
var iInterval=oDate.getTime()-oNow.getTime();
var iDays=Math.floor(iInterval/(24*60*60*1000));
var iHours=Math.floor((iInterval/(24*60*60*1000)-iDays)*24);
var iMins=Math.floor(((iInterval/(24*60*60*1000)-iDays)*24-iHours)*60);
var iSecs=Math.floor((((iInterval/(24*60*60*1000)-iDays)*24-iHours)*60-iMins)*60);
document.writeln("将2013年1月1日转换毫秒数为:"+oDate.getTime()+"<br>");
document.writeln("<p>离元旦还有:".bold().fontcolor("red")+(iDays+"天"+iHours+
"小时"+iMins+"分"+iSecs+"秒").bold().fontcolor("green")+"</p>");
var oNow=new Date();
var sDays=["日","一","二","三","四","五","六"];sDate=oNow.getYear()+"年"+
(oNow.getMonth()+1)+"月"+oNow.getDate()+
"日 星期"+sDays[oNow.getDay()]+" "+
oNow.getHours()+":"+oNow.getMinutes()+
":"+oNow.getSeconds()+"."+oNow.getMilliseconds();
var oDate=new Date(2012,11,24,0);
var iInterval=oDate.getTime()-oNow.getTime();
var iDays=Math.floor(iInterval/(24*60*60*1000));
var iHours=Math.floor((iInterval/(24*60*60*1000)-iDays)*24);
var iMins=Math.floor(((iInterval/(24*60*60*1000)-iDays)*24-iHours)*60);
var iSecs=Math.floor((((iInterval/(24*60*60*1000)-iDays)*24-iHours)*60-iMins)*60);
document.writeln("将2012年12月24日转换毫秒数为:"+oDate.getTime()+"<br>");
document.writeln("<p>离平安夜还有:".bold().fontcolor("blue")+(iDays+"天"+iHours+
"小时"+iMins+"分"+iSecs+"秒").bold().fontcolor("green")+"</p>");
</script>
</body>
</html>
这是我做的一个倒计时,你可以根据这个编写
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
楼主这问题太吓人了,建议去ITEYE网站或者CSDN上面自己搜索,里面有很多类似的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询