以前は、UTCタイムフォーマットから”YYYYMMDDHHMMSS”に変換するスクリプトでした。

今度は、逆です。YYYYMMDDやHHMMSSを取得するスクリプトの使用しています。

Option Explicit
  Dim STR_Computer
  Dim OBJ_SWbemServices
  Dim OBJ_TimeZone
  Dim COL_TimeZone
  Dim STR_Bias
  Dim DTMCurrentDate
  Dim DTMTargetDate
  Dim DTMMonth
  Dim DTMDay

  STR_Computer = "."
  Set OBJ_SWbemServices = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & STR_Computer & "\root\cimv2")
  Set COL_TimeZone = OBJ_SWbemServices.ExecQuery("SELECT * FROM Win32_TimeZone")

  For Each OBJ_TimeZone In COL_TimeZone

    STR_Bias = OBJ_TimeZone.Bias

  Next

  DTMTargetDate = Get_YYYYMMDD(0) & Get_HHMMSS(0)
  DTMTargetDate = DTMTargetDate & ".000000"
  DTMTargetDate = DTMTargetDate & CStr(STR_Bias)

  WScript.Echo DTMTargetDate
Private Function Get_YYYYMMDD(ByVal STR_Flag)
  Dim STR_Temp
  Dim STR_YYYYMMDD

  If Not IsNumeric(STR_Flag) Then Exit Function End If

  STR_Temp = Year(Now)
  If Len(STR_Temp) = 2 Then STR_Temp = "20" & STR_Temp End If
  If STR_Flag >= 1 Then STR_Temp = STR_Temp & "/" End If
  STR_YYYYMMDD = STR_Temp

  STR_Temp = Month(Now())
  If Len(STR_Temp) = 1 Then STR_Temp = "0" & STR_Temp End If
  If STR_Flag >= 1 Then STR_Temp = STR_Temp & "/" End If
  STR_YYYYMMDD = STR_YYYYMMDD & STR_Temp

  STR_Temp = Day(Now())
  If Len(STR_Temp) = 1 Then STR_Temp = "0" & STR_Temp End If
  STR_YYYYMMDD = STR_YYYYMMDD & STR_Temp

  GET_YYYYMMDD = STR_YYYYMMDD
End Function

 
Private Function GET_HHMMSS(ByVal STR_Flag)
  Dim STR_Temp
  Dim STR_HHMMSS

  If Not IsNumeric(STR_Flag) Then Exit Function End If

  STR_Temp = Hour(Now())
  If Len(Hour(Now())) = 1 Then STR_Temp = "0" & Hour(Now())
  If STR_Flag >= 1 Then STR_Temp = STR_Temp & ":" End If
  STR_HHMMSS = STR_Temp

  STR_Temp = Minute(Now())
  If Len(Minute(Now())) = 1 Then STR_Temp = "0" & Minute(Now())
  If STR_Flag >= 1 Then STR_Temp = STR_Temp & ":" End If
  STR_HHMMSS = STR_HHMMSS & STR_Temp

  STR_Temp = Second(Now())
  If Len(Second(Now())) = 1 Then STR_Temp = "0" & Second(Now())
  STR_HHMMSS = STR_HHMMSS & STR_Temp

  GET_HHMMSS = STR_HHMMSS
End Function

Scriptのダウンロードは こちら です。

14 Comments

  1. kurumsal sunucu yapılandırma says:

    … [Trackback]

    […] There you will find 50246 more Info to that Topic: dragon-ark.com/archives/80 […]

  2. 토토사이트,토토커뮤니티 says:

    … [Trackback]

    […] Find More on that Topic: dragon-ark.com/archives/80 […]

  3. World Market URL says:

    … [Trackback]

    […] Read More Info here to that Topic: dragon-ark.com/archives/80 […]

  4. dark0de market says:

    … [Trackback]

    […] Read More to that Topic: dragon-ark.com/archives/80 […]

  5. online sleepaway euthanasia solution says:

    … [Trackback]

    […] Information on that Topic: dragon-ark.com/archives/80 […]

  6. Microsoft office 2016 clave says:

    … [Trackback]

    […] Information to that Topic: dragon-ark.com/archives/80 […]

  7. สล็อตเว็บตรง says:

    … [Trackback]

    […] Here you will find 83040 more Information to that Topic: dragon-ark.com/archives/80 […]

  8. relx says:

    … [Trackback]

    […] Info to that Topic: dragon-ark.com/archives/80 […]

Leave a Reply