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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top