Top > VBScript > Date/Now/Year/Month/Day/Hour/Minute/Second


Date : yyyy/mm/dd
Now : yyyy/mm/dd hh:mm:ss
Year( Now ) : yyyy
Month( Now ) : mm
Day( Now ) : dd
Hour( Now ) : hh
Minute( Now ) : mm
Second( Now ) : ss

Option Explicit

Dim strDate
Dim strNow
Dim strYear
Dim strMonth
Dim strDay
Dim strHour
Dim strMinute
Dim strSecond

strDate   = Date
strNow    = Now
strYear   = Year( Now )
strMonth  = Month( Now )
strDay    = Day( Now )
strHour   = Hour( Now )
strMinute = Minute( Now )
strSecond = Second( Now )

WScript.Echo "Date   : " & strDate & vbcr & _
             "Now    : " & strNow & vbcr & _
             "Year   : " & strYear & vbcr & _
             "Month  : " & strMonth & vbcr & _
             "Day    : " & strDay & vbcr & _
             "Hour   : " & strHour & vbcr & _
             "Minute : " & strMinute & vbcr & _
             "Second : " & strSecond
                     ' Date   :2016/09/25
                     ' Now    :2016/09/25 13:48:31
                     ' Year   :2016
                     ' Month  :9
                     ' Day    :25
                     ' Hour   :13
                     ' Minute :48
                     ' Second :31

Year , Month , Day の引数にはDateでも取得可能



Copyright © 2015 AchaPorutePiipo All Rights Reserved.