「VBScript入門」Year()、Month()とDay()関数のサンプル
説明
Year関数 Year(varDate)
Month関数 Month(varDate)
Day関数 Day(varDate)
使用例
Dim cftA
Dim strYear
Dim strMonth
Dim strDay
cftA = Now
WScript.echo "current time: " &cftA
rem year関数
strYear =Year(Now)
WScript.echo "current year: " &strYear
rem month関数
strMonth = Month(Now)
WScript.echo "current month: " &strMonth
rem day関数
strDay = Day(Now)
WScript.echo "current day: " &strDay
Dim cftA
Dim strYear
Dim strMonth
Dim strDay
cftA = Now
WScript.echo "current time: " &cftA
rem year関数
strYear =Year(Now)
WScript.echo "current year: " &strYear
rem month関数
strMonth = Month(Now)
WScript.echo "current month: " &strMonth
rem day関数
strDay = Day(Now)
WScript.echo "current day: " &strDay
Dim cftA Dim strYear Dim strMonth Dim strDay cftA = Now WScript.echo "current time: " &cftA rem year関数 strYear =Year(Now) WScript.echo "current year: " &strYear rem month関数 strMonth = Month(Now) WScript.echo "current month: " &strMonth rem day関数 strDay = Day(Now) WScript.echo "current day: " &strDay
実行結果
current time:2020/12/24 14:54:40
current year:2020
current month:12
current day:24