I am working on editing a .VBS code. I want to have edit a date stamp in the file name.
It used to be:
dateStamp = CStr((Year(reportDate) * 10000) + (Month(reportDate) * 100) + Day(reportDate))
so: YYYYMMDD
and I wanted to have something like YYYY-MM-DD:
dateStamp = CStr(Year(reportDate)) & "-" & CStr(Month(reportDate)) & "-" & CStr(Day(reportDate))
but this code gives me YYYY-M-DD
Something like:
dateStamp = CStr(Year(reportDate)) & "-" & CStr(Right(String(2, "0") & Month(reportDate), 2)) & "-" & CStr(Day(reportDate))
doesn't work.
Could you help me with it?