Alex Rivera | Logout

set DateTime to start of month

Asked 2011-02-15T10:34:28.837
110

How can I set a DateTime to the first of the month in C#?

c#
Edit
Report

1 Answer

220
var now = DateTime.Now;
var startOfMonth = new DateTime(now.Year,now.Month,1);
answered 2011-02-15T10:37:23.877

Your Answer