2
Answers

Convert string to datetime object, C#

Ravitheja J

Ravitheja J

6y
840
1

Hi,

Can someone help me how can I convert the input string to datetime object?

eg 1:

Input--> Nov 2017 – Present
Expected Output-- > From : 1-Nov-2017, To : Today date

Logic: Start date of November to Today Date

eg 2:

Input--> Mar 2014 – Nov 2016
Expected Output-- > From : 1-Mar-2014, To : 31-Nov-2016

Logic: Start date of March to End date of November

eg 3:

Input-->2010 – 2013
Expected Output-- >From : 1-Jan-2010, To : 31-Dec-2013

Logic: If Month name is not present in the string, the output should be: Start date of year to End date of the year

Answers (2)