[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[ASP]使用CLng(Date())输出的数字从何而来。

上一篇:[转贴]《电脑爱好者》投稿写作体例
下一篇:[转贴]日语接电话常用语句

添加日期:2007/1/22 12:26:53 快速返回   返回列表 阅读5313次
如今天是2007/1/22,使用CLng(Date())输出结果为39104。

疑惑该数字从何而来。

用计算器大概算了一下,怀疑是距离1900/1/1日的天数。


sum=0
for i=1900 to 2006
    if isLeapYear(i) then
        sum=sum+366
    else
        sum=sum+365
    end if
next
sum=sum+22
Response.Write Clng(Date()) & "<br>"&sum

function isLeapYear(pYear) 
    set oreg=new RegExp 
    oreg.Pattern="^\d{4}$" 
    if not oreg.Test(pYear) then 
        isLeapYear=false 
        exit function 
    end if 
    oYear=clng(pYear) 
    if ((oYear mod 4=0 and oYear mod 100<>0) or oYear mod 400=0) then 
       isLeapYear=true 
    else 
       isLeapYear=false 
    end if 
end function



输出为:
39104
39103
差一天,不只为何。

更改系统日期,改下年份范围,发现始终差一天……

不管它了,反正都加上1就对了。
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved