In my view I am returning a string that is being converted into a DateTime in my controller. The string format is "ddd MMM dd HH:mm:ss 'EST' yyyy".
I am converting it successfully like so:
var startDate = DateTime.ParseExact(_startDate, "ddd MMM dd HH:mm:ss 'EST' yyyy", CultureInfo.InvariantCulture);
model.StartDate = Convert.ToDateTime(startDate);
The problem is that the time zones could be anything. how can I account for this? Its not always the case it will be 'EST'
. If it is EDT for example it will throw an exception.
An example input string would be: Mon Feb 20 00:00:00 EST 2017
Edit: It also can be the format ddd MMM d HH:mm:ss 'EST' yyyy
This will only be used in USA and Canada Time zones.