ACC: DateDiff() Ignores Start Date, Not End Date, with "ww"

ID: Q125003


The information in this article applies to:


SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

The online Help topic for the DateDiff() function states that when you compute the number of days (for example, the number of Sundays) between two dates using the "ww" interval, Microsoft Access ignores the end date if it falls on a Sunday but counts the beginning date if it falls on a Sunday. This information is incorrect.


RESOLUTION

When you use the "ww" interval in the DateDiff() function, Microsoft Access ignores the start date in its count if it falls on the day being counted, and counts the end date if it falls on the day being counted.


MORE INFORMATION

You can use the DateDiff() function to determine how many time intervals exist between two dates. For example, you can use the DateDiff() function to calculate the number of days between an order date and its ship date, or the number of weeks between today and the end of the year.

The exact value returned by the DateDiff() function can depend on the settings of the First Weekday and First Week options in the Options dialog box or on the values of the firstweekday or firstweek arguments. For example, if you set firstweekday to Wednesday and interval to "ww" then the DateDiff() function returns the number of Wednesdays between two dates.

NOTE: In Microsoft Access for Windows 95 version 7.0, the First Weekday and First Week options are NOT available. You cannot set these options through Visual Basic for Applications. Microsoft Access 7.0 uses Sunday as the default First Weekday, and January 1 as the default First Week.


REFERENCES

For more information about the DateDiff() function, search for "DateDiff," and then "DateDiff Function" using the Microsoft Access Help menu.

Additional query words: date diff dif


Keywords          : kbusage 
Version           : 2.0 7.0
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: April 7, 1999