Sunday, May 26, 2013

Get List of Weeks of Current month in c# dropdownlist of visual web-part

You can try this code posted at link


http://makhaai.blogspot.in/2008/04/get-week-of-year.html



protected void Page_Load(object sender, EventArgs e)
{
Response.Write(getWeek(DateTime.Now));
}
public int getWeek(DateTime date)
{
System.Globalization.CultureInfo cult_info = System.Globalization.CultureInfo.CreateSpecificCulture("no");
System.Globalization.Calendar cal = cult_info.Calendar;
int weekCount = cal.GetWeekOfYear(date, cult_info.DateTimeFormat.CalendarWeekRule, cult_info.DateTimeFormat.FirstDayOfWeek);
return weekCount;

}







Everything about SQL Server | Experience inside SQL Server -Mohammad Nizamuddin

No comments:

Post a Comment