ic ic

ic ic

  • NA
  • 85
  • 0

Week Number of day, like VB Function DATEPART

Nov 13 2009 6:14 AM

Hi, I need help.
I need to get the week number of day, 
like the VB Function: [code] DATEPART("ww", Now()) [/code]
I tried this but it does not calculate correctly as when the 1st is on Saterday (week1) & calculates on the 3rd Monday
the below code sees it as still part of week1 & not week 2
[code]
  WeekOfYear = Convert.ToString(Math.Ceiling(Convert.ToDouble(ManufactureDateVar.DayOfYear) / 7));
[/code]
I need to somehow replicate the VB Function in C# to the correct week number
Please Assist!

Answers (3)