I have date like 08/31/2013 and i want in which week given date falls.So please help me how can i achieved it.For e.g give date falls in 5th week of August.
Asked
Active
Viewed 3,987 times
2
-
http://stackoverflow.com/a/11155102/1460657 here is a answer – Anant Dabhi Mar 28 '14 at 07:44
3 Answers
1
Try
var currCulture = CultureInfo.CurrentCulture;
var weekNo = currCulture.Calendar.GetWeekOfYear(
new DateTime(2014, 28, 03), //Any date
currCulture.DateTimeFormat.CalendarWeekRule,
currCulture.DateTimeFormat.FirstDayOfWeek);

MusicLovingIndianGirl
- 5,909
- 9
- 34
- 65
1
Found this here. Check if helps.
DateTime dt = DateTime.Now;
int weekOfMonth = (dt.Day + ((int)dt.DayOfWeek)) / 7 + 1;

Nitin Varpe
- 10,450
- 6
- 36
- 60
1
DateTime dt = DateTime.Today;
CultureInfo ci = CultureInfo.CurrentCulture;
int weekNum = ci.Calendar.GetWeekOfYear(dt, CalendarWeekRule.FirstFullWeek, DayOfWeek.Monday);
weekNum = weekNum / 12;
string weekday = dt.DayOfWeek.ToString();
With this code you will be able to get week number and week day of any date.....

user3459148
- 19
- 7