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

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

WMI の日付と時刻は、DMTF の日付時刻書式で表現されます。この書式については、WMI SDK のマニュアルに説明されています。DMTF の日付時刻を表した文字列は、現在のタイム ゾーンの UTC オフセットを計算に入れた値となります。DMTF の精度の最小単位はマイクロ秒です。DateTime の精度の最小単位は Ticks (100 ナノ秒) です。変換時に、Ticks はマイクロ秒に変換され、最も近いマイクロ秒に丸められます。
.NET Framework のセキュリティ
指定された DateTime を DMTF 日付時刻書式に変換する例を次に示します。
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.ToDmtfDateTime メソッドを検索する場合は、下記のリンクをクリックしてください。

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