I am trying to convert string to DateTimeOffset.I am using DatetimeOffset.Parse(string).Parse obviously throws an exception when string is not in correct format.It is not able to parse 0000-00-00.
I want a single line of code saying me the best possible way to tackle this situation.If input is 0000-00-00 then it should be converted to current DateTimeOffset.
Any other string also apart from 0000-00-00 that cant be parsed should be changed to DateTimeOffset.Now.
"0000-00-00"parse as?