Fromat Date Wrong value for month

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")
 
S

SurturZ

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top