Get the current date method one:
Copy Code code as follows:
Currentdate1=date ()
MsgBox Currentdate1
Get the current date method two:
Copy Code code as follows:
Currentdate2=year (now) & "-" &month (now) & "-" &day (now)
MsgBox Currentdate2
Add a: If you want to get a date preceded by a 1-digit front complement 0, such as May 2016 16, if the directory is 2016516 better than 20160516
Copy Code code as follows:
Ystr=year (now)
Mstr=month (now)
If Len (MSTR) <2 then mstr= "0" &mstr
Dstr=day (now)
Dateml=ystr&mstr&dstr
MsgBox (Dateml)
Get the current time:
Copy Code code as follows:
Currenttime=hour (now) & ":" &minute [Now] & ":" &second (now)
m = "Current Time" & CurrentTime
MsgBox m
Use VBS under Windows to take the day before the current date and correct the output format
My_date1 = DATEADD ("D", -1,date)
Action: Take the day before the current time (the current time is the system time) and assign the result to the variable my_date1
My_date2 = DatePart ("yyyy", my_date1) & "-" & Right ("0" & DatePart ("M", My_date1), 2) & "-" & Right ("0" & DatePart ("D", My_date1), 2)
Function: Regardless of the time format set by the system (default is YYYY/M/D), modify the output time format as YYYY-MM-DD, and assign the result to the variable My_date2
Time to view output:
MsgBox my_date1
MsgBox My_date2
The above script is tested by WINDOWS2003, 2008