Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16036

vbscript not taking current date it means not taking year

$
0
0
the following vbscript i used to take backup from desktop to F drive it is also when copying also rename the file and add todays date to the file name,but you know just year is change now year is 2021 but after copying file through this vbscript it is taking year 2020 that is the problem please solve my problem

Code:

'***************************************************************
'***************************************************************
'* This Batch File must be run the day on the day after whatever
'* ASPLAY list that is to be copied was created.  It will copy
'* the ASPLAY and ONAIR lists and rename them to be text files
'* and have the date included in the title - ASPLAY_YYMMDD.txt
'***************************************************************

Dim FSO, thisday
Set FSO = CreateObject("Scripting.FileSystemObject")
Today_Date()
FSO.CopyFile "C:\Users\Administrator\Desktop\PANA.xlsm", "F:\pana\pana_" & thisday & ".xlsm"


' ***************************************************************
' ### This funtion gets the date in format yymmdd ###
'***************************************************************
Function Today_Date()

thisday=Right(Day(Date),2) & "-" & Right("0" & Month(Date),2) & "-" & Right("0" & Year(Date - 1),2)

End Function
' ***************************************************************


Viewing all articles
Browse latest Browse all 16036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>