

#BATCH FILE TIME 24 HOUR FORMAT CODE#
Okies I fixed it so it will write AM or PM in the file and the display, however I still dun like it this is what I did.Īctually the code does work quite contrary to your guarantee.īut I'm still having problems with the windows file order at times the am's and pm's get mixed up because they are of the same date and retrival times differ depending on my connection so a file retrived at 12:11 am may get mixed in with files retrived between 12:10 pm and 12:30 pm.

Well I using the script I found on the website attached just modified some display components.Īlso I see the padding down there I see that somehow it will display it in a way that trunicates the 0 if it's a 2 digit month or day fine now I just need a way to set a variable that will display either am or pm after it retrives it from where ever my script retieves it's timeĪctually I fixed the am/pm thing but I still got a few problems look at both code pieces below Wait a minute that link is to this post :S You'd be better off using this script to figure out the components of the date - it works independently of the regional date setting, or so it claims. (untested, only showing the changed code):

However, to answer your question, you'll need to pad the month, day, and hour with zeros. I have to agree that this isn't the best script in the world. Well, it's still not using the best method to get the date components. ]ĮDIT: Oops, that's not your script is it. I don't really understand why you're using "net time" to get the date - you're making your life more difficult than it needs to be.
#BATCH FILE TIME 24 HOUR FORMAT ISO#
:: note ISO 8601 date format would require 4 digit YYYY Year)įOR /f "tokens=6-8 delims=/ " %%G IN ('NET TIME \\%computername%') DO (įOR /f "tokens=1,2 delims=: " %%G IN ('time/t') DO (ĮCHO Today is Year: Month: Day: :: To change the filename format just change around the last line below ECHO Will rename the file in the format "Test In a batch file use CALL STAMPME.
