Saturday, 25 January 2014

Convert a WMI CIM_DATETIME value to a C# .NET DateTime object

We've been using WMI for a long time and one of the oddities is the WMI DateTime format which you may have noticed are in a format that looks like the following


To convert this to a .NET DateTime object I've seen many workarounds and hand written parsing methods on the Internet, if you're using these I'd strongly recommend that you move to the ManagementDateTimeConverter this is a built in class designed for converting WMI CIM_DATETIME values to .NET DateTime objects.

If you're using WMI to audit your network devices you may be interested to look at our Server Documentation Tool

No comments:

Post a Comment