Here is the more accurate method to get date,
New Date(2008, 12, 29)
Since some users have different Regional Settings therefore "Month
Name" will also NOT work.
On Nov 14, 9:47 am, sallushan <[EMAIL PROTECTED]> wrote:
> Try putting the date as,
>
> CDate("29-Dec-2008") and CDate("3-Jan-2009")
>
> On my system I have results 53 and 1
>
> My Regional Settings = English (United States)
>
> Note that always use 'Month Name' (instead of Month Number) in the
> Date string. This removes the chances of incorrect conversion of date,
> since different users have different Regional Settings.
>
> On Nov 13, 9:49 pm, Duckster101 <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > I am trying to use the DatePart function to return the week number for
> > a specific date. I have been having difficulty getting it to return
> > the correct week number.
>
> > When I use the DatePart function using all the same parameters except
> > the date, the function returns different results.
>
> > For example:
>
> > DatePart(DateInterval.WeekOfYear, CType(“12/29/08”, Date),
> > FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays)
> > Returns 53
>
> > DatePart(DateInterval.WeekOfYear, CType(“1/3/09”, Date),
> > FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays)
> > Returns 52
>
> > As you can see, the only thing different between these two functions
> > is the date that is passed. Both of these dates fall within the same
> > week, so why the difference in what it returns?- Hide quoted text -
>
> - Show quoted text -