How do I retrieve the "Week" of a 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
 
C

Craig Deelsnyder

M

Mark Rae

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

Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top