Congratulations to all the winners of April 2013, they have won INR 3400 cash and INR 20147 worth prizes !
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 26480 |  Welcome, Guest!   Register  Login
 Home > Coding Horrors > C# > Weeks of dates range ...
Leila

Weeks of dates range

 Coding Horror posted by: Leila | Posted on: 4/15/2012 | Category: C# | Views: 2364 | Level: Starter | Status: [Member] | Points: 75 | Alert Moderator   



private string GetWeeks(DateTime date1, DateTime date2)
        {
            string weeks = string.Empty;
            DateTime date = date1;
            int weekNumber = 1;
            while (date <= date2)
            {
                weeks += "Week " + weekNumber.ToString() + "- (Start Date): ";
                weeks += date.ToShortDateString() + " to (End Date) ";
                date = date.AddDays(6);
                if (date > date2)
                    date= date2;
                weeks += date.ToShortDateString();
                date = date.AddDays(1);
                weeks += Environment.NewLine;
                weekNumber++;
            }
            return weeks;
           
        }



Thanks,
Leila
Found interesting? Add this to:


About Leila Khalil

Experience:5 year(s)
Home page:http://www.dotnetfunda.com
Member since:Wednesday, April 11, 2012
Level:Starter
Status: [Member]
Biography:
>> Write Response - Respond to this post and get points

More Coding Horrors

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/20/2013 11:55:31 AM