In the development of a member management system, the customer request in the bulletin board of the three days of all the members of the birthday show, how to extract the 3-day birthday members?
First of all, of course. With the DateDiff function, DateDiff can return the difference between two dates.
Expression DateDiff (Timeinterval,date1,date2 [, FirstDayOfWeek [, FirstWeekOfYear]])
Allow data type: TimeInterval represents a type of time separated by the following code:
"Y" means "year"
"M" means "month"
"D" means "day"
"H" means "time"
"N" means "min"
"s" means "seconds."
Example: <%
FromDate = #9/9/00#
ToDate = #1/1/2000#
Response.Write "There are" & _
DateDiff ("D", Fromdate,todate) & _
"Millenium from 9/9/00."
%>
Return result: There are 150 days from 9/9/00 to 2000.
But how do you get a yearly birthday membership through the above function? This requires us to think with extrapolate thinking, because the birthday to judge the number of months and days to match on it, look at the following function bar, directly to fix all the problems, the principle of implementation is very simple:
Calculates the day difference between the date of a member's birthday and that of Arisisi:
Example: A member's birthday: 1980-12-20, to come to a function:
<%=DateDiff ("D", Now (), "" &year (now) & " -12-20")%>
Is it simple?
OK, theASP calculates the birthday time the tutorial to write here, welcome continues to support Arisisi (www.alixixi.com) The Web development NET, here you will see more original articles!