I was wondering if it is possible to convert custom formatted DateTimes to something more standardized.
I have two types of date-formats in string.
string Date1 = @"06.12.2015 18.00";
string Date2 = @"1944-09-29";
and I want to convert both to these kind of format:
yyyy-MM-ddThh:mm:ssZ
How do i do this?
I tried
DateTime testdate = DateTime.ParseExact(Date1,
"yyyy-MM-ddThh:mm:ssZ",
CultureInfo.InvariantCulture);
but with no luck.
EDIT: Thsi question was flagged as possible duplicate to another entry in StackOverflow. The difference here is, as Vadim Yarovikov in the comments below put it, a two part question. "1) Parse value to date and 2) Convert date to desired format."