Click here to Skip to main content
15,880,796 members
Articles / Programming Languages / Visual Basic
Alternative
Tip/Trick

First day date in week based on particular date

Rate me:
Please Sign up or sign in to vote.
3.50/5 (3 votes)
6 Dec 2010CPOL 6.5K   2   2
public DateTime GetFirstDayOfWeek2( DateTime date) { return date.AddDays(-(int)date.DayOfWeek); }
C#
public  DateTime GetFirstDayOfWeek2( DateTime date)
        {
            return date.AddDays(-(int)date.DayOfWeek);
        }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) University of Iowa Hospitals and Clinics
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralReason for my vote of 2 The other examples use the FirstDayO... Pin
Richard Deeming10-Dec-10 8:17
mveRichard Deeming10-Dec-10 8:17 
GeneralReason for my vote of 5 Nice Pin
sc2p6-Dec-10 22:02
sc2p6-Dec-10 22:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.