C# DateTime from Month and Year
Posted on 2015-02-23
I have the following, Month Abbreviation such as Jan and Year such as 2015 in a string "Jan 2015". I need to take that and get the 1st and last day of that month into two datetime variables.
I got the month abbreviation using:
DateTimeFormatInfo mfi = new DateTimeFormatInfo();
mfi.GetAbbreviatedMonthName(1) as an example.
I guess I need to parse the numeric and string portion to do this? So in the above case Jan 2015 I would want two datetime variables as:
DateTime startDate = 1/12015
DateTime endDate = 1/31/2015