ASP calculates birthdays (days away from birthdays) function

Source: Internet
Author: User
Tags return

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!




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.