Fromat Date Wrong value for month

  • Thread starter Thread starter cmdolcet69
  • Start date Start date
C

cmdolcet69

If i format my date string to look like month,day,year when i look at
the file created it will look like:
Raw Data File 37 05 08 10 58 12

were the 37 comes from i dont know the 37 should be 09

The code is below:

strtempfile = strtempfile.Substring(0, strtempfile.Length - 4) & " Raw
Data File" & Format(Now, "-m-dd-yy-hh-mm-ss")
 
lower case m is minutes, uppercase M is Month.

I think you want
Format(Now, "MMddyyHHmmss")

Although I would suggest this instead

Format(Now, "yyyyMMddHHmmss")

so that they sort properly in Windows Explorer
 
Back
Top