How the ASP handles the date. From Zdtips, in 中文版

Source: Internet
Author: User
Tags date1
Date Manipulation with VBScript

Beyond simply displaying the date, VBScript provides a number of functions
That's allow to manipulate dates. The DATEADD (interval, number, date)
and DateDiff (interval, date1, date2) are helpful functions that are
Usually left for the developer to write.

Both functions require to the interval argument. This argument
Specifies the interval to the "date" or to compare the dates.
The DATEADD (interval, number, date) function returns a date is the
Specified number of intervals from the given date. The DateDiff (interval,
Date1, Date2) function returns the number of intervals between date1 and
Date2.

There is also a handy function called DateSerial (year, month, day)
Returns a variant of the Date subtype. This function was very useful when
You are need to create a date (such as Christmas) for use in the DateDiff ()
function.

The following code shows these three functions in action:

<% dtoday = Date ()%>
In ten days it'll be
<%= DateAdd ("D", Dtoday)%>
<P>
<% Dchristmas = DateSerial (1998,12,25)%>

Christmas is just <%= DateDiff ("D", Dtoday, Dchristmas)%> days away!

From--zd Journals ' Active Server developers Journal



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.