Hi,
I am wondering how you would convert the date and time from 20100131022308.000000-360.
I've been trying to figure it out for a while now and I can't seem to get anywhere.
I am using C# in a WPF Application.
Hi,
I am wondering how you would convert the date and time from 20100131022308.000000-360.
I've been trying to figure it out for a while now and I can't seem to get anywhere.
I am using C# in a WPF Application.
Ignore everything after the period:
string date = "20100131022308.000000-360";
date = date.Substring(0, date.IndexOf('.'));
DateTime actualDate = DateTime.ParseExact(date, "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
Console.WriteLine(actualDate);
It's a pretty straightforward date format.
The System.Management.ManagementDateTimeConverter class was made to solve your problem. Use its ToDateTime() method. It properly parses milliseconds and the UTC offset in the string:
DateTime dt = System.Management.ManagementDateTimeConverter.ToDateTime("20100131022308.000000-360");
Console.WriteLine(dt);
Output: 1/31/2010 2:23:08 AM