Created
October 4, 2012 12:55
-
-
Save honda0510/3833375 to your computer and use it in GitHub Desktop.
UTCをJSTに変換
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Sub test() | |
Dim WmiDateTime As WmiDateTime | |
Set WmiDateTime = New WmiDateTime | |
WmiDateTime.Value = "20121004010446.000000-000" | |
Debug.Print WmiDateTime.LocalDateTime | |
' 2012/10/04 10:04:46 | |
WmiDateTime.Value = "20121004100446.000000+540" | |
Debug.Print WmiDateTime.LocalDateTime | |
' 2012/10/04 10:04:46 | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Private m_datetime As Object | |
Private Sub Class_Initialize() | |
Set m_datetime = CreateObject("WbemScripting.SWbemDateTime") | |
End Sub | |
Public Property Let Value(WmiDateTime As String) | |
m_datetime.Value = WmiDateTime | |
End Property | |
Public Property Get Value() As String | |
Value = m_datetime.Value | |
End Property | |
Public Sub SetDateTime(DateTime As Date, Optional IsLocal As Boolean = True) | |
m_datetime.SetVarDate DateTime, IsLocal | |
End Sub | |
Public Property Get LocalDateTime() As Date | |
LocalDateTime = m_datetime.GetVarDate(True) | |
End Property | |
Public Property Get UTC() As Date | |
UTC = m_datetime.GetVarDate(False) | |
End Property |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment