Here is my code:
DateTime startDate = Convert.ToDateTime( orderDate ).AddMonths(-1);
DateTime endDate = Convert.ToDateTime( orderDate );
orderDate is a valid date I pass in.
How do I always guarantee startDate is the first day of the previous month for orderDate? How do I always guarantee endDate is the last day of the month for orderDate?
Example:
orderDate = 5/4/2012
I want startDate to be 4/1/2012 (or 04/1/2012 whichever is default)
I want endDate to be 4/30/2012
How can I acheive this?