Thursday, September 23, 2010

VBScript DateDiff Function


DateDiff function
Back to the time interval between two dates.
DateDiff (interval, date1, date2 [, firstdayofweek [, firstweekofyear]])
DateDiff function syntax has the following parameters:
Parameter
interval
Required. String expression that is used to calculate the time between date1 and date2 interval. The values, see "Settings" section.
date1, date2
Required. Date of expression. Used to calculate the two dates.
Firstdayofweek
Optional. The first day of the week specified constant. If not specified, the default is Sunday. The values, see "Settings" section.
Firstweekofyear
Optional. Designated the first week of the year constant. If not specified, the default location for the January 1st week. The values, see "Settings" section.
Set up
interval parameter can have the following values:
Setting Description
yyyy Year
q Quarterly
n months
y number of days a year
d day
w the number of days a week
ww Week
h hours
m min
s seconds

firstdayofweek parameter can have the following values:
Constant Value Description
use of regional language support vbUseSystem 0 (NLS) API set.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday

firstweekofyear parameter can have the following values:
Constant Value Description
use of regional language support vbUseSystem 0 (NLS) API set.
vbFirstJan1 1 by the Jan. 1 week where the (default).
vbFirstFourDays 2 by the New Year at least four days in the first week.
vbFirstFullWeek 3 in the new year by the first full week.

Explain
DateDiff function is used to determine between the two dates specified number of time intervals. For example, you can use the DateDiff calculation of the number of days difference between two dates, or the day of the year the number of weeks between the last day.
To calculate the difference between date1 and date2 number of days, you can use "the number of days a year" ("y") or "Day" ("d"). When the interval is "the number of days a week" ("w") when, DateDiff returns the number of weeks between two dates. If date1 is Monday, the Monday before date2 DateDiff to calculate the number. This result contains does not contain date2 date1. If the interval is the "Week" ("ww"), the DateDiff function returns the calendar in the number of weeks between two dates. Between date1 and date2 function calculates the number of Sundays. If date2 is Sunday, DateDiff to calculate date2, but even if date1 is Sunday, it will not count date1.
If date1 is later than date2, the DateDiff function returns a negative number.
firstdayofweek 鍙傛暟浼氬浣跨敤鈥渨鈥濆拰鈥渨w鈥濋棿闅旂鍙风殑璁$畻浜х敓褰卞搷銆?br />濡傛灉 date1 鎴?date2 鏄棩鏈熸枃瀛楋紝鍒欐寚瀹氱殑骞村害浼氭垚涓烘棩鏈熺殑鍥哄畾閮ㄥ垎銆備絾鏄鏋?date1 鎴?date2 琚寘鎷湪寮曞彿 ( ) 涓苟涓旂渷鐣ュ勾浠斤紝鍒欏湪浠g爜涓瘡娆¤绠?date1 鎴?date2 琛ㄨ揪寮忔椂锛屽皢鎻掑叆褰撳墠骞翠唤銆?This can be written for different years of the program code.
鍦?interval 涓衡?骞粹?锛堚?yyyy鈥濓級鏃讹紝姣旇緝 12 鏈?31 鏃ュ拰鏉ュ勾鐨?1 鏈?1 鏃ワ紝铏界劧瀹為檯涓婂彧鐩稿樊涓?ぉ锛孌ateDiff 杩斿洖 1 琛ㄧず鐩稿樊涓?釜骞翠唤銆?br />
涓嬮潰鐨勭ず渚嬪埄鐢?DateDiff 鍑芥暟鏄剧ず浠婂ぉ涓庣粰瀹氭棩鏈熶箣闂撮棿闅斿ぉ鏁?
Function DiffADate(theDate)聽 DiffADate = 浠庡綋澶╁紑濮嬬殑澶╂暟: & DateDiff(d, Now, theDate)End Function






相关链接:



DivX to VOB



web Seo 2



On the memory leak (1)



Servlet 2.5 Version Of The Termination Response



Fast roaming Illustrator 10 (1)



Maxthon financial pages and information on-line grand



The other side of performance evaluation [1]



Picked Trace And Ping Tools



Premier Server Applications



FLV to 3GP



Visuanl C # 2005 Quick Start of the while statement (1)



Yunjie: Mr. Chen in the "CORRECTION"?



TS to WMV



Simple Management And Distribution



Brief Remote Computing



No comments:

Post a Comment