ACC2: DatePart(), DateDiff() Functions Ignore Global Settings

Last reviewed: May 21, 1997
Article ID: Q121012
The information in this article applies to:
  • Microsoft Access version 2.0

SUMMARY

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

In Microsoft Access, you can use the First Week and First Weekday options settings to specify values other than the default values of January 1 for the first week, and Sunday for the first week day.

If you do use these option settings to change the default values, you must specify the optional setting when you use either the DatePart() or the DateDiff() function.

To change these option settings, click Options on the View menu, select General in the Category box, and then in the Items box select the option you want to change.

MORE INFORMATION

In Microsoft Access, two new parameters have been added to the DatePart() and DateDiff() functions. The new parameters are FirstWeek and FirstWeekDay. If you change the default setting for the First Week or the First Weekday option, you must explicitly define the matching parameter when you use the DatePart() or DateDiff() function.

For example, if you set the First Week option setting to First Full Week, and the First Weekday option setting to Monday, use the following syntax for the DateDiff() and DatePart() functions:

  • DateDiff("ww","11/1","11/30",2,3)

    -or-

    DateDiff("ww","11/1","11/30",MONDAY,3)

    -or-

    DateDiff("ww","11/1","11/30",MONDAY,0)

  • DatePart("w","31-Dec",2,3)

    -or-

    DatePart("w","31-Dec",MONDAY,3)

    -or-

    DatePart("w","31-Dec",MONDAY,0)

REFERENCES

For more information about the DateDiff function, search the Help Index for "DateDiff function."

For more information about DatePart function, search the Help Index for "DatePart function."


Keywords : kbusage SynFnc
Version : 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 21, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.