PRB: Week Starts Sunday and Ends Saturday for Format Function (110667)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q110667 SYMPTOMS
For 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.
CAUSE
In 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.
STATUS
This behavior is by design.
Modification Type: | Minor | Last Reviewed: | 2/24/2005 |
---|
Keywords: | kbprb KB110667 |
---|
|