SoFunction
Updated on 2025-04-08

vbs get the code for the current time and date

Method 1 to get the current date:

Copy the codeThe code is as follows:

Currentdate1=date()
msgbox Currentdate1

Get the current date method two:

Copy the codeThe code is as follows:

Currentdate2=year(Now)&"-"&Month(Now)&"-"&day(Now)
msgbox Currentdate2

Get the current time:

Copy the codeThe code is as follows:

CurrentTime=Hour(Now)&":"&Minute(Now)&":"&Second(Now)
m = "Current Time" & CurrentTime
msgbox m