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. 如何查看一個網頁源代碼的最後更新時間
點瀏覽器文件選項的另存為,打開另存為的文件,會顯示源代碼,這里可以看到發布時間,即使網站上不顯示時間,源代碼也會顯示出對方上傳信息,既頁面更新的使用電腦顯示時間。