PRB: Week Starts Sunday and Ends Saturday for Format FunctionLast reviewed: March 20, 1998Article ID: Q110667 |
3.00
WINDOWS
kbprg kbcode kbprb
The information in this article applies to:
SYMPTOMSFor the date of Sunday January 2, 1994, the Format("01/02/94","ww") function returns week number 2 instead of week number 1. NOTE: Visual Basic handles dates according to the Country settings in the International option of the Windows Control Panel. When the Country is set to United States, dates such as "01/05/94" are by default interpreted with the month followed by the day, as in mm/dd/yy. For most other Country settings, the day precedes the month, and "05/01/94" is interpreted as dd/mm/yy.
CAUSEIn the Format function, weeks start on a Sunday and go through the following Saturday. In 1994, January 1 is a Saturday, which is the only day in week 1. Week 2 of 1994 starts on Sunday January 2. Therefore, the Format("01/01/94","ww") function returns 1, and Format("01/02/94","ww") returns 2.
STATUSThis behavior is by design.
MORE INFORMATIONBelow are some of the format expressions for the day, week, month, and quarter, as supported by the Format function: dd Displays the day as a number with a leading zero (01-31). ddd Displays the day as an abbreviation (Sun-Sat). dddd Displays the day as a full name (Sunday-Saturday). w Displays the day of the week as a number (1 for Sunday through 7 for Saturday.)ww Displays the week of the year as a number (1-53). m Displays the month as a number without a leading zero (1-12). If m immediately follows h or hh, the minute rather than the month is displayed.mm Displays the month as a number with a leading zero (01-12). If m immediately follows h or hh, the minute rather than the month is displayed.mmm Displays the month as an abbreviation (Jan-Dec). mmmm Displays the month as a full month name (January-December). q Displays the quarter of the year as a number (1-4). For more information, see the Format and Format$ function topics in the Visual Basic Help menu.
Steps to Reproduce Behavior
|
Additional reference words: 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |