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

16010101000000.000000+000

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

Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Enable function lock for F1-F12 on HP ZBook mobile workstations