Hi, I am trying to get a particular piece of VBScript to give me the previous days date in YYMMDD format.
Here is some sample code I found online and modified for my needs, however, this code does not work on the 1st day of each month (IE: If it is April 1, 2009 the script returns 090431 instead of 090331).
I have tried other ways to get the date in the proper format as well, the code below works fine to get the current date in YYMMDD format.
I also tried the second snippet below, however this time I am losing the leading zero if the DAY, or MONTH are single digit (IE: if it is April 1, 2009 the script returns 0941 instead of 090401).
It is imperative the script does not drop the leading zeroes from the days or months, as I am using it to retrieve IIS log files... It feels like I almost have this figured out, but I can't quite come to a solution. Please help!
'Code snippet #1'
yesterday = Right(Year(Date),2) & Right("0" & Month(Date),2) & Right("0" & Day(Date() -1),2)
'Code snippet #2'
logDate = FormatDateTime(date() -2,2)
logDateP = Replace(logDate, "/", "")