关于asp下Date Diff函数的参数说明
DateDiff函数描述
返回两个日期之间的时间间隔。
语法
DateDiff(interval,date1,date2[,firstdayofweek][,firstweekofyear]])
DateDiff函数的语法有以下参数:
参数描述
interval必选。字符串表达式,表示用于计算date1和date2之间的时间间隔。有关数值,请参阅“设置”部分。
date1,date2必选。日期表达式。用于计算的两个日期。
firstdayofweek可选。指定星期中第一天的常数。如果没有指定,则默认为星期日。有关数值,请参阅“设置”部分。
firstweekofyear可选。指定一年中第一周的常数。如果没有指定,则默认为1月1日所在的星期。有关数值,请参阅“设置”部分。
设置
interval参数可以有以下值:
设置描述
yyyy 年
q 季度
m 月
y 一年的`日数
d 日
w 一周的日数
ww 周
h 小时
m 分钟
s 秒
firstdayofweek参数可以有以下值:
常数值描述
vbUseSystem0使用区域语言支持(NLS)API设置。
vbSunday1星期日(默认)
vbMonday2星期一
vbTuesday3星期二
vbWednesday4星期三
vbThursday5星期四
vbFriday6星期五
vbSaturday7星期六
firstweekofyear参数可以有以下值:
常数值描述
vbUseSystem0使用区域语言支持(NLS)API设置。
vbFirstJan11由1月1日所在的星期开始(默认)。
vbFirstFourDays2由在新年中至少有四天的第一周开始。
vbFirstFullWeek3由在新的一年中第一个完整的周开始。
说明
DateDiff函数用于判断在两个日期之间存在的指定时间间隔的数目。例如可以使用DateDiff计算两个日期相差的天数,或者当天到当年最后一天之间的星期数。
要计算date1和date2相差的天数,可以使用“一年的日数”(“y”)或“日”(“d”)。当interval为“一周的日数”(“w”)时,DateDiff返回两个日期之间的星期数。如果date1是星期一,则DateDiff计算到date2之前星期一的数目。此结果包含date2而不包含date1。如果interval是“周”(“ww”),则DateDiff函数返回日历表中两个日期之间的星期数。函数计算date1和date2之间星期日的数目。如果date2是星期日,DateDiff将计算date2,但即使date1是星期日,也不会计算date1。
如果date1晚于date2,则DateDiff函数返回负数。
firstdayofweek参数会对使用“w”和“ww”间隔符号的计算产生影响。
如果date1或date2是日期文字,则指定的年度会成为日期的固定部分。但是如果date1或date2被包括在引号("")中并且省略年份,则在代码中每次计算date1或date2表达式时,将插入当前年份。这样就可以编写适用于不同年份的程序代码。在interval为“年”(“yyyy”)时,比较12月31日和来年的1月1日,虽然实际上只相差一天,DateDiff返回1表示相差一个年份。
相關文章
-
The Bad Effects of Fake Diplomas英语作文
The Bad Effects of Fake DiplomasThere has been a serious epidemic of fake diplomas in some big cities recently. Obviously, its appearance and development involve two parts: the demander and the suppli -
DOS的Expand、Fasthelp、Fc命令使用说明
导语:Expand、Fasthelp、Fc命令都分别有不同的功能,下面就由小编为大家介绍一下DOS的`Expand、Fasthelp、Fc命令使用说明,大家一起去看看吧! expand:解压工具[适用场合]微软公司软件原始安装盘中有许多后缀以"_"结尾的压 -
私家车的坏处The Disadvantages of Private Cars英语作文
The Disadvantages of Private CarsAs the development of the world, our country’s economy has become more and more better, people’s life standard has become much better, so people have money to amuse. -
Different ideas about time的英语阅读
Different people have different ideas about time. People in the USA think that it is important to know the time. In American cities, there are clocks in stations, factories and other buildings. Radio -
国中英语《I used to be afraid of the dark》优秀教案
1.整体设计思路、指导依据说明The students of Grade 9 have been leaing English for more than two years, they have leaed many new words, at the same time, and they are growing up. Their physical appearan -
JavaScript在Android的WebView中parseInt函数转换不正确
今天被一个问题困扰,有一个页面在浏览器(无论是手机还是PC)上运行良好,而通过WebView就出现了问题,有两个值得计算始终出错。于是就通过alert,把这个值显示出来,发现和浏览器上计算的结果差了很多,本来是正数,却变成了负数。仔 -
Food and place of interest in Beijing国中英语作文
Hello,welcome to Beijing a chinese ,I am gald to tell you something about Beijing. Now, please quite and listen me Do you know Beijing Roast Duck is so delicious that people all over the world like -
关于Applying For A Student Discount Card的留学英语口语
JOHN: Excuse me. Do you have a minute?I'd like to tell you about the Bucky Card.DAVE: Well... alright. I guess I have a minute.JOHN: Do you know about the Bucky Card?DAVE: I've heard about it, -
Zend studio for eclipse中使php可以调用mysql相关函数的设置方
Zend studio for eclipse中使php可以调用mysql相关函数的设置方法教程如果直接调用mysql_connect会出现:Fatal error: Call to undefined function mysql_connect() 的错误解决办法,找到zend studio 所在的`位置我的zen -
The Bitter and Happiness of Study英语作文
The Bitter and Happiness of StudyBefore I went to school, I felt so excited, because I was so curious about the campus life. Now I have been in middle school, after seven years’ study, I feel the bit