A. 求大神JS制作日期计算器的源代码
<!DOCTYPEhtml>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=UTF-8">
<title>
RunJS演示代码
</title>
<script>
onload=function(){
varreg=/^d{4}(-d{2}){2}$/,reg2=/[^d]+/g;
btn.onclick=function(){
vard1=start.value,d2=end.value;
if(!reg.test(d1)||!reg.test(d2)){
alert("输入日期格式必须为yyyy-mm-dd");
}
else{
varg1=newDate(d1.replace(reg2,'/'));
varg2=newDate(d2.replace(reg2,'/'));
if(g2<g1){
alert("结束日期不能早于开始日期");
}
else{
vargap=Math.floor((g2-g1)/1000/60/60/24)-1;
result.innerHTML=d1+"至"+d2+"之间共"+gap+"天";
}
}
}
}
</script>
</head>
<body>
开始日期:
<inputtype="text"id="start"/>
<br/>
结束日期:
<inputtype="text"id="end"/>
<br/>
<buttonid="btn">
计算
</button>
<br/>
<br/>
结果:
<divid="result">
</div>
</body>
</html>
B. 我想在源码上加个程序,比如客户网站是今天开通的,网站的使用期只有一年,还剩10天到期的时候,提醒续费
你自己写吧,这个简单。
1、写一个文本文件,里面写好开通日期或者到期日期。
2、用户登录界面或者首页加入编程。
2、编写一个程序
2.1、计算今天和文本日期的时间,快要到期,弹出提醒用户页面,至于每天的提醒次数你自己可以设定,记录次数加入文本中以供读取和判断。
2.2、计算今天和文本日期的时间,已经到期。把页面跳转到你用户到期页面。
C. 制作网页,谁给我个日期时间的源码,要网络时间
简单!<script>setInterval("linkweb.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
</script>
我的西度网站就是用这个的 现在升级中! 当然你也可以将星期前面的英文和星期去掉 包括标点符号 就是和你的格式一样的
D. 求即时库存查询源码!
1、我们通过SQL事件探查器(这可真是个好东东啊!),不难跟踪到以下内容
EXEC CheckInventory
2、我们进入SQL企业管理器,也不难得到CheckInventory的详细代码[K/310.1]
CREATE Procere CheckInventory
as
Declare @CurYear Int, --当前年份
@CurPeriod int, --起始的会计期间
@StartPeriod SmallInt, --启用期间
@NowPeriod Smallint, --当前期间
@StartTime DateTime, --期间开始日期
@EndTime DateTime, --期间结束日期
@DiffCount Decimal(28,0) --计算是否有差异数量
--2.取出当前年份
SELECT @CurPeriod=FValue FROM t_Systemprofile WHERE FKey='CurrentPeriod' And FCategory='IC'
SELECT @CurYear=FValue FROM t_Systemprofile WHERE FKey='CurrentYear' And FCategory='IC'
--3.取出当前期间的起始日期
EXEC GetPeriodStartEnd @CurPeriod,@StartTime output,@EndTime output
SELECT FItemID,FStockID,FBatchNo,FStockPlaceID,case when FKFDate is null then '' else convert(varchar(10),FKFDate,120) End as FKFDate,ISNULL(FKFPeriod,'') as FKFPeriod,
Sum(FBegQty) As FQty ,0 As FQtyLock Into #RealTimeQty
FROM ICInvBal WHERE FPeriod=@CurPeriod And FYear=@CurYear
Group By FItemID,FStockID,FBatchNo,FStockPlaceID,FKFDate,FKFPeriod
Having sum(FBegQty)<>0
--SELECT FItemID,FStockID,FBatchNo,FQty FROM #RealTimeQty
Insert Into #RealTimeQty
SELECT t1.FItemID,t2.FDCStockID As FStockID,IsNull(t1.FBatchNO,''),ISNULL(t1.FDCSPID,'') as FStockPlaceID, case when FKFDate is null then '' else convert(varchar(10),FKFDate,120) end ,ISNULL(t1.FKFPeriod,''),
Sum(t1.FQty) As FQty,0 As FQtyLock
FROM ICStockBillEntry t1,ICStockBill t2
WHERE t1.FInterID=t2.FInterID And (t2.FCheckerID>0 or t2.FCheckerID <0 or FUpStockWhenSave=1)
And t2.FCancelLation=0
And t2.FTranType In (1,2,5,10,40,41) And FDate>=@StartTime
Group By t1.FItemID,t2.FDCStockID,t1.FBatchNo,t1.FDCSPID,t1.FKFDate,t1.FKFPeriod
......[以下代码省略]
3、我们也不难看出其中几个参数的意思
@CurYear Int, --当前年份
@CurPeriod int, --起始的会计期间 [原代码注释可能有歧义,应为当前期间,当然,也可以解释为校对即时库存的起始期间]
@StartPeriod SmallInt, --启用期间 [该参数基本没有用]
@NowPeriod Smallint, --当前期间 [源代码注释错了,该参数基本没有用]
@StartTime DateTime, --期间开始日期
@EndTime DateTime, --期间结束日期[该参数基本没有用]
@DiffCount Decimal(28,0) --计算是否有差异数量
除了几个没有使用的参数外,其他几个重要的参数就是时间节点了。
从SQL代码可以看出,“校对”即时库存的功能应该就是从当前期间的第一天开始的。
4、我们是否可以经过改进,来控制校对即时库存的起始点呢?应该是可以的。
CREATE Procere CheckInventoryEX
@CurYear Int=0, --起始年份
@CurPeriod int=0, --起始会计期间
as
Declare @StartPeriod SmallInt, --启用期间
@NowPeriod Smallint, --当前期间
@StartTime DateTime, --期间开始日期
@EndTime DateTime, --期间结束日期
@DiffCount Decimal(28,0) --计算是否有差异数量
--2.取出当前年份
if @CurPeriod<=0 or @CurPeriod>12
begin
SELECT @CurPeriod=FValue FROM t_Systemprofile WHERE FKey='CurrentPeriod' And FCategory='IC'
end
if @CurYear<=0
begin
SELECT @CurYear=FValue FROM t_Systemprofile WHERE FKey='CurrentYear' And FCategory='IC'
end
--3.取出当前期间的起始日期
EXEC GetPeriodStartEnd @CurPeriod,@StartTime output,@EndTime output
SELECT FItemID,FStockID,FBatchNo,FStockPlaceID,case when FKFDate is null then '' else convert(varchar(10),FKFDate,120) End as FKFDate,ISNULL(FKFPeriod,'') as FKFPeriod,
Sum(FBegQty) As FQty ,0 As FQtyLock Into #RealTimeQty
FROM ICInvBal WHERE FPeriod=@CurPeriod And FYear=@CurYear
Group By FItemID,FStockID,FBatchNo,FStockPlaceID,FKFDate,FKFPeriod
Having sum(FBegQty)<>0
--SELECT FItemID,FStockID,FBatchNo,FQty FROM #RealTimeQty
Insert Into #RealTimeQty
SELECT t1.FItemID,t2.FDCStockID As FStockID,IsNull(t1.FBatchNO,''),ISNULL(t1.FDCSPID,'') as FStockPlaceID, case when FKFDate is null then '' else convert(varchar(10),FKFDate,120) end ,ISNULL(t1.FKFPeriod,''),
Sum(t1.FQty) As FQty,0 As FQtyLock
FROM ICStockBillEntry t1,ICStockBill t2
WHERE t1.FInterID=t2.FInterID And (t2.FCheckerID>0 or t2.FCheckerID <0 or FUpStockWhenSave=1)
And t2.FCancelLation=0
And t2.FTranType In (1,2,5,10,40,41) And FDate>=@StartTime
Group By t1.FItemID,t2.FDCStockID,t1.FBatchNo,t1.FDCSPID,t1.FKFDate,t1.FKFPeriod
E. 计算日期差的网站,例如可以查询:2001年1月21日与2009年5月9日有多少天,多少小时的网页
你可以在 EXCEL 中自己设一个表格啊
http://..com/question/12048748.html?si=3
你对EXCEL了解一些吧,看这个应该对你有帮助的
还有这个
http://..com/question/17555484.html?si=2
希望对你有用
F. 点在图片上 显示日历框 可以选择日历上的日期 来查询对应时间数据库的信息 这个JSP代码怎么写
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page language="java" import="java.util.*" %>
<%
response.setHeader("Cache-Control", "no-store");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
%>
<html>
<head>
<title>选择日期</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META name="GENERATOR" content="IBM WebSphere Studio">
<style>
SELECT {FONT-SIZE: 9pt; LINE-HEIGHT: 11pt}
TEXTAREA {FONT-SIZE: 9pt; LINE-HEIGHT: 11pt}
INPUT {FONT-SIZE: 9pt; LINE-HEIGHT: 11pt}
TD {FONT-SIZE: 9pt; LINE-HEIGHT: 11pt}
.p { font-size: 12px; line-height: 18px}
.pp { font-size: 14px; line-height: 18px}
.cals{font-family: "Arial"color:#000000; font-size:10pt}
</style>
<%@page import = "java.util.StringTokenizer"%>
<%
String type = request.getParameter("type");
if (type==null) type="1";
Calendar cal = Calendar.getInstance();
String cur_date = cal.get(Calendar.YEAR) + "年" + (cal.get(Calendar.MONTH)+1)
+ "月" + cal.get(Calendar.DAY_OF_MONTH)+"日";
int cur_year = cal.get(Calendar.YEAR);
int cur_month = (cal.get(Calendar.MONTH)+1);
int cur_day = cal.get(Calendar.DAY_OF_MONTH);
String cur_date_string = String.valueOf(cur_year) + "-"
+ (cur_month<10?("0"+String.valueOf(cur_month)):String.valueOf(cur_month)) + "-"
+ (cur_day<10?("0"+String.valueOf(cur_day)):String.valueOf(cur_day));
String parmInitDate = request.getParameter("initdate");
int parm_year=0;
int parm_month=0;
int parm_day=0;
if(parmInitDate!=null){
StringTokenizer mytoken = null;
try{
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd");
java.util.Date date = null;
date = formatter.parse(parmInitDate);
//java.util.Calendar cal = new java.util.Calendar()
cal.setTime(date);
parm_year = cal.get(Calendar.YEAR);
parm_month = cal.get(Calendar.MONTH) + 1;
parm_day = cal.get(Calendar.DAY_OF_MONTH );
}catch(Exception e){
//out.print(e);
}
}
parm_year= parm_year==0?cur_year:parm_year;
parm_month= parm_month==0?cur_month:parm_month;
parm_day= parm_day==0?cur_day:parm_day;
%>
<script LANGUAGE="vbscript">
<!--
dim cal(6,7)
dim sToday
dim sCurDate
dim sSeldate
dim selx,sely
sCurdate="<%=cur_date_string%>"
sSeldate="<%=parm_year+"-"+parm_month+"-"+parm_day%>"
sub getDate()
if window.event.srcElement.innerText = "" or window.event.srcElement.innerText = " " then exit sub
for i = 1 to 6
for j = 1 to 7
if cal(i,j).bgcolor="#0000ff" then
cal(i,j).bgcolor=""
cal(i,j).style.color="black"
end if
next
next
if window.event.srcElement.bgcolor<>"#ffff00" then
window.event.srcElement.bgcolor="blue"
window.event.srcElement.style.color="white"
end if
aa = window.year.value & "-" & right(window.month.value+100,2) & "-" & right(window.event.srcelement.innertext+100,2)
window.sel_date.innerText=aa
end sub
sub getTime()
aa=""
if window.hour.value<>"00" or window.minute.value<>"00" or window.second.value<>"00" then
aa=window.hour.value & ":" & window.minute.value & ":" & window.second.value
end if
if window.sel_date.innerText = "" then
window.sel_date.innerText = sCurDate
end if
window.sel_time.innerText=aa
end sub
sub ret ()
if window.sel_date.innerText <> "" then
window.returnValue = window.sel_date.innerText
if window.sel_time.innerText="" then
window.sel_time.innerText=window.hour.value & ":" & window.minute.value & ":" & window.second.value
end if
if window.sel_time.innerText <>"" then
window.returnValue = window.sel_date.innerText & " " & window.sel_time.innerText
end if
end if
window.event.returnValue = false
set cal(6,7) = nothing
window.close()
end sub
sub cancel ()
window.returnValue = ""
window.event.returnValue = false
set cal(6,7) = nothing
window.close()
end sub
sub draw
dim yy,mm,dd,thisday,lastmm,maxday
dim nextmm
yy = window.year.value
mm = window.month.value
dd = datepart("d",sSeldate)
thisday = dateserial (yy,mm,1)
set cal(1,1) = t10:set cal(1,2) = t11:set cal(1,3) = t12:set cal(1,4) = t13:set cal(1,5) = t14:set cal(1,6) = t15:set cal(1,7) = t16
set cal(2,1) = t20:set cal(2,2) = t21:set cal(2,3) = t22:set cal(2,4) = t23:set cal(2,5) = t24:set cal(2,6) = t25:set cal(2,7) = t26
set cal(3,1) = t30:set cal(3,2) = t31:set cal(3,3) = t32:set cal(3,4) = t33:set cal(3,5) = t34:set cal(3,6) = t35:set cal(3,7) = t36
set cal(4,1) = t40:set cal(4,2) = t41:set cal(4,3) = t42:set cal(4,4) = t43:set cal(4,5) = t44:set cal(4,6) = t45:set cal(4,7) = t46
set cal(5,1) = t50:set cal(5,2) = t51:set cal(5,3) = t52:set cal(5,4) = t53:set cal(5,5) = t54:set cal(5,6) = t55:set cal(5,7) = t56
set cal(6,1) = t60:set cal(6,2) = t61:set cal(6,3) = t62:set cal(6,4) = t63:set cal(6,5) = t64:set cal(6,6) = t65:set cal(6,7) = t66
for i = 1 to 6
for j = 1 to 7
cal(i,j).innertext = " "
cal(i,j).style.cursor = ""
cal(i,j).bgcolor=""
next
next
// cal(1,cint(datepart("w",thisday))).innertext = 1
// cal(1,cint(datepart("w",thisday))).style.cursor="hand"
//计算选择缺省日期
lastmm = datepart("m",thisday)
nextmm = lastmm + 1
if nextmm= 13 then nextmm = 1
maxday = datepart("d",dateadd("d",-1,dateserial (yy,nextmm,"1") ) )
if dd>maxday then dd = maxday
//缺省
i = 1 'the line
do until (datepart("m",thisday) - lastmm <>0)
if datepart ("w",thisday) = 1 then i = i + 1
cal(i,cint(datepart("w",thisday))).innertext = datepart("d",thisday)
if thisday=date then
cal(i,cint(datepart("w",thisday))).bgcolor="#A7A4D9" 'tt1
cal(i,cint(datepart("w",thisday))).style.color="red"
else
cal(i,cint(datepart("w",thisday))).style.color="black"
end if
if(datepart("d",thisday)=dd) then
if thisday<>date then
cal(i,cint(datepart("w",thisday))).bgcolor="blue"
cal(i,cint(datepart("w",thisday))).style.color="white"
end if
dim showday
showday = datepart("yyyy",thisday)& "-"
if(datepart("m",thisday)<10) then
showday = showday & "0"
end if
showday = showday & datepart("m",thisday)& "-"
if(datepart("d",thisday)<10) then
showday = showday & "0"
end if
showday = showday & datepart("d",thisday)
window.sel_date.innerText= showday
end if
cal(i,cint(datepart("w",thisday))).style.cursor="hand"
thisday = thisday + 1
loop
for i = 1 to 6
for j = 1 to 7
cal(i,j).style.fontsize = "9pt" '" normal small-caps 8pt serif"
next
next
end sub
sub up()
for i = 1 to 6
for j = 1 to 7
if cal(i,j).bgcolor="#0000ff" then
cal(i,j).bgcolor=""
cal(i,j).style.color="black"
end if
next
next
if window.month.value = 12 then
if window.year.value < 2100 then window.year.value = window.year.value + 1
window.month.value = 1
else
window.month.value = window.month.value + 1
end if
draw()
end sub
sub down ()
for i = 1 to 6
for j = 1 to 7
if cal(i,j).bgcolor="#0000ff" then
cal(i,j).bgcolor=""
cal(i,j).style.color="black"
end if
next
next
if window.month.value = 1 then
if window.year.value > 1996 then window.year.value = window.year.value - 1
window.month.value = 12
else
window.month.value = window.month.value - 1
end if
draw()
end sub
-->
</script>
<script ID="clientEventHandlersVBS" LANGUAGE="vbscript">
<!--
Sub year_onchange
draw()
End Sub
Sub month_onchange
draw()
End Sub
sub init ()
aa = date()
bb = <%=parm_year%>
if bb >= 1950 and bb <= 2100 then window.year.value = bb
bb = <%=parm_month%>
window.month.value = bb
sToday=<%=parm_day%>
draw ()
end sub
-->
</script>
<script language="javascript" for="t1" event="onkeydown">
//Esc退出
var keyDown = event.keyCode
if(keyDown==27){
window.close()
}
</script>
</head>
<body onload="init" leftmargin="12" topmargin="7" >
<center>
<!--<font class='pp'>今天是<%=cur_date%></font><br> -->
<table border="0" width="200" cellspacing="0" cellpadding="1" bgcolor="snow" id="t1" align="center">
<tr>
<td colspan='7' nowrap >
<select id="year" name="year">
<%for (int i=2000; i<=2020; i++) {%>
<option value=<%=i%>><%=i%></option>
<%}%>
</select>
<select id="month" name="month">
<%for (int i=1; i<=12; i++) {%>
<option value=<%=i%>><%=i%>月</option>
<%}%>
</select>
<img src="../images/arr04.gif" id="up" language="vbscript" style='cursor:hand' onclick="down()" accesskey=1 align="absmiddle">
<img src="../images/arr05.gif" id="down" language="vbscript" style='cursor:hand' onclick="up()" accesskey=2 align="absmiddle">
</td>
</tr>
<tr>
<td colspan='7' height="5" > </td>
</tr>
<tr bgcolor="#7975C6">
<td align='center' class="cals" height="23" align="absmiddle">日</td>
<td align='center' class="cals" align="absmiddle">一</td>
<td align='center' class="cals" align="absmiddle">二</td>
<td align='center' class="cals" align="absmiddle">三</td>
<td align='center' class="cals" align="absmiddle">四</td>
<td align='center' class="cals" align="absmiddle">五</td>
<td align='center' class="cals" align="absmiddle">六</td>
</tr>
<%for (int i=1; i<=6; i++) {%>
<tr bgcolor="#e6e6fa">
<%for (int j=0; j<=6; j++) {%>
<td align='center' id=t<%=i%><%=j%> onclick="getDate()" ondblclick="ret()" class="cals"></td>
<%}%>
</tr>
<%}%>
<%String disp=null;%>
<%if (type.compareTo("2")==0) {%>
<tr>
<td colspan='7' nowrap height="28" align="center" valign="bottom" >
<select id="hour" name="hour" onchange='getTime()'>
<%
for (int i=0; i<=23; i++) {
disp=String.valueOf(i);
if (disp.length()==1) disp = "0"+disp;
%>
<option value=<%=disp%><%if (i==0) out.print(" selected");%>><%=disp%></option>
<%}%>
</select><font class='p'>时</font>
<select id="minute" name="minute" onchange='getTime()'>
<%
for (int i=0; i<=59; i++) {
disp=String.valueOf(i);
if (disp.length()==1) disp = "0"+disp;
%>
<option value=<%=disp%><%if (i==0) out.print(" selected");%>><%=disp%></option>
<%}%>
</select><font class='p'>分</font>
<select id="second" name="second" onchange='getTime()'>
<%
for (int i=0; i<=59; i++) {
disp=String.valueOf(i);
if (disp.length()==1) disp = "0"+disp;
%>
<option value=<%=disp%><%if (i==0) out.print(" selected");%>><%=disp%></option>
<%}%>
</select><font class='p'>秒</font>
</td></tr>
<%}%>
</table>
<table border='0' width='180' style="display:none">
<tr>
<td nowrap>
时间:
<font color='red'>
<span id='sel_date' name='sel_date'></span>
<span id='sel_time' name='sel_time'></span>
</font>
</td>
</tr>
</table>
<table border='0' cellspacing="0" cellpadding="0" >
<tr><td height="4"></td></tr>
<tr><td align="absmiddle"><img src="../images/bt_sure.gif" onclick='ret()'></td></tr>
</table>
</center>
<%
String initH="00";
String initM="00";
String initS="00";
if(type.equals("2")){
if(parmInitDate==null) parmInitDate="";
parmInitDate=parmInitDate.trim();
if(parmInitDate.length()>10){
initH=parmInitDate.substring(11,13);
initM=parmInitDate.substring(14,16);
initS=parmInitDate.substring(17,19);
}else{
//初始化为当前时间
java.text.SimpleDateFormat sdf=null;
String curTime="";
try{
sdf=new java.text.SimpleDateFormat("HH:mm:ss");
curTime=sdf.format(new java.util.Date());
}catch(Exception e){
curTime="00:00:00";
System.out.println("格式为日期出错");
}
initH=curTime.substring(0,2);
initM=curTime.substring(3,5);
initS=curTime.substring(6,8);
}
}
%>
<script language="javascript">
var itype='<%=type %>';
var hh='<%=initH %>';
var mm='<%=initM %>';
var ss='<%=initS %>';
if(itype=='2'){
//初始化数据
var objh=document.getElementById('hour');
var objm=document.getElementById('minute');
var objs=document.getElementById('second');
objh.value=hh;
objm.value=mm;
objs.value=ss;
}
</script>
</body>
</html>
G. 求:php网页中时间过期提示源代码
$d=ceil((strtotime('2020-2-19')-time())/3600/24);
if($d>0){
echo "距离结束还剩".$d."天";
}else{
echo "已失效";
}
H. 求时间日期html代码,带农历!(高手进)
下面代码可以实现你要的功能,如下。至于你看不到它的真实的源代码,它可能通过程序动态加载,或者是js调用。你看到的,仅仅是静态的html代码而已!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>单行带农历的日期时间代码</title>
</head>
<body>
<SCRIPT language=JavaScript>
<!--
function CalConv()
{
FIRSTYEAR = 1998;
LASTYEAR = 2031;
today = new Date();
SolarYear = today.getFullYear();
SolarMonth = today.getMonth() + 1;
SolarDate = today.getDate();
Weekday = today.getDay();
LunarCal = [
new tagLunarCal( 27, 5, 3, 43, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1 ),
new tagLunarCal( 46, 0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ),
new tagLunarCal( 35, 0, 5, 53, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1 ),
new tagLunarCal( 23, 4, 0, 59, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
new tagLunarCal( 42, 0, 1, 4, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
new tagLunarCal( 31, 0, 2, 9, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),
new tagLunarCal( 21, 2, 3, 14, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 ),
new tagLunarCal( 39, 0, 5, 20, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 ),
new tagLunarCal( 28, 7, 6, 25, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 ),
new tagLunarCal( 48, 0, 0, 30, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ),
new tagLunarCal( 37, 0, 1, 35, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1 ),
new tagLunarCal( 25, 5, 3, 41, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),
new tagLunarCal( 44, 0, 4, 46, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),
new tagLunarCal( 33, 0, 5, 51, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
new tagLunarCal( 22, 4, 6, 56, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ),
new tagLunarCal( 40, 0, 1, 2, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ),
new tagLunarCal( 30, 9, 2, 7, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),
new tagLunarCal( 49, 0, 3, 12, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1 ),
new tagLunarCal( 38, 0, 4, 17, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 ),
new tagLunarCal( 27, 6, 6, 23, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1 ),
new tagLunarCal( 46, 0, 0, 28, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0 ),
new tagLunarCal( 35, 0, 1, 33, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ),
new tagLunarCal( 24, 4, 2, 38, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),
new tagLunarCal( 42, 0, 4, 44, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ),
new tagLunarCal( 31, 0, 5, 49, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 ),
new tagLunarCal( 21, 2, 6, 54, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),
new tagLunarCal( 40, 0, 0, 59, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ),
new tagLunarCal( 28, 6, 2, 5, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 ),
new tagLunarCal( 47, 0, 3, 10, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1 ),
new tagLunarCal( 36, 0, 4, 15, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1 ),
new tagLunarCal( 25, 5, 5, 20, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ),
new tagLunarCal( 43, 0, 0, 26, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 ),
new tagLunarCal( 32, 0, 1, 31, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0 ),
new tagLunarCal( 22, 3, 2, 36, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0 ) ];
SolarCal = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
SolarDays = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 396, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 397 ];
if ( SolarYear <= FIRSTYEAR || SolarYear > LASTYEAR ) return 1;
sm = SolarMonth - 1;
if ( sm < 0 || sm > 11 ) return 2;
leap = GetLeap( SolarYear );
if ( sm == 1 )
d = leap + 28;
else
d = SolarCal[sm];
if ( SolarDate < 1 || SolarDate > d ) return 3;
y = SolarYear - FIRSTYEAR;
acc = SolarDays[ leap*14 + sm ] + SolarDate;
kc = acc + LunarCal[y].BaseKanChih;
Kan = kc % 10;
Chih = kc % 12;
Age = kc % 60;
if ( Age < 22 )
Age = 22 - Age;
else
Age = 82 - Age;
if ( acc <= LunarCal[y].BaseDays ) {
y--;
LunarYear = SolarYear - 1;
leap = GetLeap( LunarYear );
sm += 12;
acc = SolarDays[leap*14 + sm] + SolarDate;
}
else
LunarYear = SolarYear;
l1 = LunarCal[y].BaseDays;
for ( i=0; i<13; i++ ) {
l2 = l1 + LunarCal[y].MonthDays[i] + 29;
if ( acc <= l2 ) break;
l1 = l2;
}
LunarMonth = i + 1;
LunarDate = acc - l1;
im = LunarCal[y].Intercalation;
if ( im != 0 && LunarMonth > im ) {
LunarMonth--;
if ( LunarMonth == im ) LunarMonth = -im;
}
if ( LunarMonth > 12 ) LunarMonth -= 12;
today=new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
document.write("", today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日",d[today.getDay()+1],"");
months = ["一","二","三","四","五","六","七","八","九","十","十一","十二"];
days = ["初一","初二","初三","初四","初五","初六","初七","初八","初九","初十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十"];
document.write( "农历"+months[LunarMonth-1]+"月" + days[LunarDate-1] + "");
return 0;
}
function GetLeap( year )
{
if ( year % 400 == 0 )
return 1;
else if ( year % 100 == 0 )
return 0;
else if ( year % 4 == 0 )
return 1;
else
return 0;
}
function tagLunarCal( d, i, w, k, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13) {
this.BaseDays = d;
this.Intercalation = i;
this.BaseWeekday = w;
this.BaseKanChih = k;
this.MonthDays = [ m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13 ];
}
//-->
</SCRIPT>
<a target=_blank href=http://www.qpsh.com><FONT color=#2b68a7><SCRIPT>CalConv();</SCRIPT></FONT></a>
</body>
</html>
I. 将日期动态显示在网页上的源代码
可参考试用下。
<!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=gb2312" />
<title>动态年月日时分秒</title>
<script language="javascript" type="text/javascript">
function now(){
var today=new Date(); //声明日期对象实例
var year=today.getFullYear(); //获取年份
var month=today.getMonth()+1; //获取月份(0-11)
var day=today.getDate(); //获取日
var hour=today.getHours(); //获取小时
var minute=today.getMinutes(); //获取分钟
var second=today.getSeconds(); //获取秒
var week=today.getDay(); //获取星期(0-6)
var week_array=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
month=month<10 ? "0"+month : month;
day=day<10 ? "0"+day : day;
hour=hour<10 ? "0"+hour : hour;
minute=minute<10 ? "0"+minute : minute;
second=second<10 ? "0"+second : second;
var time="<font color='#999999'><b>今天是:</b></font>"+year+"年"+month+"月"+day+"日 "+week_array[week]+" "+hour+":"+minute+":"+second;
bgclock.innerHTML=time;
setTimeout("now()",1000);
}
</script>
</head>
<body>
<div id="bgclock"><script language="javascript">now();</script></div>
</body>
</html>
J. 如何查看一个网页源代码的最后更新时间
点浏览器文件选项的另存为,打开另存为的文件,会显示源代码,这里可以看到发布时间,即使网站上不显示时间,源代码也会显示出对方上传信息,既页面更新的使用电脑显示时间。