How do I retrieve the "Week" of a date?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm trying to find out how I can retrieve the week value of a date.

Today we have 2005-05-08 and week 18.

Let's say I had a dropdownlist with values 1 to 53 and wanted to
programmatically decide what week we have today and accordingly set the
dropdownlist with the correct week value.

Any code that would describe that?

TIA

Kenneth P
 
I'm trying to find out how I can retrieve the week value of a date.

Today we have 2005-05-08 and week 18.

Let's say I had a dropdownlist with values 1 to 53 and wanted to
programmatically decide what week we have today and accordingly set the
dropdownlist with the correct week value.

Any code that would describe that?

DateTime dtmDate = DateTime.Now();
int intWeekOfYear = System.Globalization.Calendar.GetWeekOfYear(dtmDate);
 
Back
Top