Reputation: 499
When I run this in C# in .net452,
DateTime myDateTime = Convert.TodateTime("2019-10-22T14:32:54.67685+01:00")
on my rig I get eg 22/10/2019 14:32:54, but on my client pc, I'm seeing "2019-10-27 01:32:54".
How do I convert that string to a local date time on the PC?
This article tells you how to convert to that format, but I need the reverse.
Pointers please!
Upvotes: 0
Views: 864
Reputation: 163
There are few ways to format the date .
Convert.ToDateTime("12/02/21 10:56:09").ToString("MMM.dd,yyyy HH:mm:ss");
Use DateTime.ParseExact, e.g.:
DateTime.ParseExact("12/02/21 10:56:09", "yy/MM/dd HH:mm:ss",
CultureInfo.InvariantCulture
).ToString("MMM. dd, yyyy HH:mm:ss")
Upvotes: 1