I’m calling .NET’s DateTime.ParseExact with a custom format string along the lines of "MM/dd/yyyy h:mmt". This string handles four-digit years but not two-digit years. Is there a way to handle both cases in a single ParseExact call? I’ve tried "MM/dd/yy h:mmt" and it only handles the two-digit case.
I’m calling .NET’s DateTime.ParseExact with a custom format string along the lines of MM/dd/yyyy
Share
You can pass an array of format strings for the second parameter on this overload of
ParseExact– this would include both the 2 and 4 year variants.