Explanation of DateDiff function in VB

Source: Internet
Author: User
Tags date1

How to use DateDiff function in VB
DateDiff (interval, Date1, date2[,firstweekofyear[,firstweekofyear])
Returns a Variant (long) that represents the number of time intervals between two specified dates
interval: Sets the unit of the period calculation between two dates. For example, >interval= "m" means the calculated unit is month. >interval setting values such as:
yyyy > Year
Q Quarter season
M month
D Day
W Weekday Week
H Hour Time
n Minute min

s Second s
Date1, Date2: Two date expressions during calculation, if >date1 earlier, the period between two dates is positive, and if >date2 earlier, the result is negative.
firstweekofyear: Set the first day of the week to a few days, if not set as Sunday. The setting values for the >FW are as follows:
0 Use the Set value of the >API.
1 Sunday
2 Monday
3 Tuesday
4 Wed
5 Thu
6 Friday
7 Saturday
firstweekofyear: Set the first week of the year, if not set, it means the week of January 1 is the first week of the year. The setting values for the >fy are as follows:
0 Use the Set value of the >API.
1 January 1 that week is the first week of the year
2 contains at least four days of the first week for the first week of the year
3 contains seven day first week for first week of year
The scale is as follows:
Calculates the number of months between two dates.
DIFFMONTHL = DateDiff ("M", Date_start, Date_end)


Explanation of DateDiff function in VB

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.