Find Sundays between two dates in asp.net C# .
Introduction : In this article i will show you how to get all Sundays between two dates in asp.net c# .
Following is function i have written for getting all Sundays between two dates in c# .It is very just you need to add code and you will able get all Sundays between two dates in c# .
protected void Page_Load(object sender, EventArgs e) { DateTime Dt1 = DateTime.Now; DateTime Dt2 = DateTime.Now.AddDays(30); GetAllSundays(Dt1, Dt2); } public void GetAllSundays(DateTime Date1, DateTime Date2) { TimeSpan DateDiff = Date2.Subtract(Date1); for (int i = 0; i <= DateDiff.Days; i++) { if (Date1.Date.AddDays(i).DayOfWeek == DayOfWeek.Sunday) { Response.Write(Date1.Date.AddDays(i).ToLongDateString() + " " + Date1.Date.AddDays(i).DayOfWeek + ""); } } }
Hey I discovered this web site to be actually interesting!
ReplyDeleteBookmarked!
My blog; Trying To Conceive Tips
Very interesting and good Explanation on asp .net ..
ReplyDeleteASP.NET Training
ASP NET Training
ASP.NET Online Training
C# Training
C# Online Training
C-Sharp Training
Dot Net Training in Chennai
.Net Online Training
ASP.NET Training
Good one
ReplyDelete