First and last day in month




While coding a solution to parse billings I needed to find first and last days in month. The first day is easy - just set "01" for day. But for last day there is nice solution, hope it'll help you

   DateTime today = DateTime.Today;
   DateTime endOfMonth = new DateTime(today.Year, today.Month, 1).AddMonths(1).AddDays(-1);

 




No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment





MarkiMarta.com. Notes of web-specialist
Since 2009
18+