This question already has an answer here:
- VBScript How can I Format Date? 6 answers
- Format current date and time in VBScript 1 answer
I need format the date of the previous day in this format, with VBScript :
yyyymmdd
And I have tried this solution :
NewData = Right(Year(DateSerial(Year(Date()),Month(Date()),1)),4) &_
Right(String(2, "0") &_
Month(DateSerial(Year(Date()),Month(Date()),1)), 2) &_
Right(String(2, "0") &_
Day(DateAdd("d",-1, Now())), 2)
But instead of getting :
20190630
I have :
20190730
Can you help me ?
Thanks in advance for any help.