ASP gets the day article and supports the method of the day after the previous day

Source: Internet
Author: User
Tags add current time end query reference variable
Today, a friend of the group browsing my asp98.cn website, she said it is best to do a list of the day's content, users are generally lazy to look down. Feel very reasonable, this is the so-called user experience, hehe! Say you're going to get it! So get to 1:30 P.M. ...--

The content list is very simple, here is not much to say, first idea, define a variable to get the value to query the database. If empty, it equals the current time.

The definition of a variable

The code is as follows:
Dim variable name ' name yourself, I don't have a name.

IF request.querystring ("parameter") = "" Then

Variable name = Now ()

Else

Variable name = request.querystring ("parameters")

End If

Second, to determine whether the date format is correct

I think it's important for him to be here when the program is done.

(Knowledge point: IsDate function)

The following is a reference fragment:
If not IsDate (variable name) Then
Variable name = Now ()
End If

Third, database query
(Knowledge point: A datediff time function is used here)

The following is a reference fragment:
SQL = "SELECT * from [table] where DATEDIFF (' d ', Database Time, '" & Variable Name & ') =0 ORDER by ID Desc "
...............
...........

http:www.asp98.cn

Four, finally add a link

The following is a reference fragment:
One day after the previous day

One day later, you can add a judgment

<%if DateDiff ("D", variable name, now ()) >0 then%> display the link after day <%end

About this link, (*^__^*), I tried a lot of methods are not get the correct results, so the most stupid way, is to read out the month and a day, and then in the place of the day to add and subtract. Dear friends, if there is a better way, please contact me Oh! Please see the http://asp98.cn/Arclist.asp page of this site!



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.