You are not logged in.
Pages: 1
Hi,
Is it possible to grab the system (or universal) time and convert it to a YYYY-MM-DD-HH-MM-SS format? I have been looking through the SS64 site and have done several googles but haven't managed to find anything useful yet.
Thanks for you time,
Si++
Offline
You should be able to modify this to get the format you want: just leave out the last part on the last line
http://ss64.com/vb/syntax-getdatetime.html
Alternatively, if you just want to assume the 20th century, any of the other scripts (under Syntax) can be modified like so:
SET YYYY=20%YY%
Offline
The TIME command and the %time% variable are supposed to use the same format. However, this is what I get on my Windows 7 machine:
C:\>time /t
05:23 PM 1723
C:\>echo %time%
17:23:09.48
I am able to edit the time format for the time command, but I don't know where the time format for the environment variable %time% is set. Can anyone help with this?
Offline
time /t and %time% are a built in command and variable respectively. If it's even possible to customise them, I doubt it's a good idea.
That said, you can manipulate the output they produce into some other form which might be the solution you're looking for -- what exactly are you trying to achieve?
cmd | *sh | ruby | chef
Offline
Pages: 1