ManagementDateTimeConverter.ToDateTime メソッド
アセンブリ: System.Management (system.management.dll 内)

Dim dmtfDate As String Dim returnValue As DateTime returnValue = ManagementDateTimeConverter.ToDateTime(dmtfDate)
戻り値
指定された DMTF の日付時刻値を表す DateTime。

WMI の日付と時刻は、DMTF の日付時刻書式で表現されます。この書式については、WMI SDK のマニュアルに説明されています。DMTF の日付時刻文字列には、この日付時刻文字列で表される UTC オフセットが含まれます。DateTime への変換時には、日付を現在のタイム ゾーンに変換するために UTC オフセットが使用されます。DMTF 書式に準じて、特定のフィールドを文字 '*' で表現できます。この文字は、DateTime で表現されるフィールドの MinValue 値に変換されます。
.NET Framework のセキュリティ
DMTF の日付時刻文字列を DateTime に変換する例を次に示します。
Imports System Imports System.Management 'The sample below demonstrates the various conversions ' that can be done using ManagementDateTimeConverter class Class Sample_ManagementClass Public Overloads Shared Function Main(ByVal args() As String) _ As Integer Dim dmtfDate As String = "20020408141835.999999-420" Dim dmtfTimeInterval As String = "00000010122532:123456:000" 'Converting DMTF datetime and intervals to System.DateTime Dim dt As DateTime = _ ManagementDateTimeConverter.ToDateTime(dmtfDate) 'Converting System.DateTime to DMTF datetime dmtfDate = _ ManagementDateTimeConverter.ToDmtfDateTime(DateTime.Now) ' Converting DMTF timeinterval to System.TimeSpan Dim tsRet As System.TimeSpan = _ ManagementDateTimeConverter.ToTimeSpan(dmtfTimeInterval) 'Converting System.TimeSpan to DMTF time interval format Dim ts As System.TimeSpan = _ New System.TimeSpan(10, 12, 25, 32, 456) Dim dmtfTimeInt As String dmtfTimeInt = _ ManagementDateTimeConverter.ToDmtfTimeInterval(ts) Return 0 End Function End Class
using System; using System.Management; // The sample below demonstrates the various conversions // that can be done using ManagementDateTimeConverter class class Sample_ManagementDateTimeConverterClass { public static int Main(string[] args) { string dmtfDate = "20020408141835.999999-420"; string dmtfTimeInterval = "00000010122532:123456:000"; // Converting DMTF datetime to System.DateTime DateTime dt = ManagementDateTimeConverter.ToDateTime(dmtfDate); // Converting System.DateTime to DMTF datetime string dmtfDateTime = ManagementDateTimeConverter.ToDmtfDateTime(DateTime.Now); // Converting DMTF time interval to System.TimeSpan System.TimeSpan tsRet = ManagementDateTimeConverter.ToTimeSpan(dmtfTimeInterval); //Converting System.TimeSpan to DMTF time interval format System.TimeSpan ts = new System.TimeSpan(10,12,25,32,456); string dmtfTimeInt = ManagementDateTimeConverter.ToDmtfTimeInterval(ts); return 0; } }


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からManagementDateTimeConverter.ToDateTime メソッドを検索する場合は、下記のリンクをクリックしてください。

- ManagementDateTimeConverter.ToDateTime メソッドのページへのリンク