DateTime format year.month.day hour:minute:second (all with leading zeros) e.g.: 2013.05.24 07:30:04
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
PowerShell [System.DateTime]::Now.ToString("yyyy.MM.dd HH:mm:ss") Get-Date -Format "yyyy.MM.dd HH:mm:ss" RHEL date '+%Y.%m.%d %k:%M:%S' HP-UX date '+%Y.%m.%d %H:%M:%S' C# DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); PHP date('Y.m.d H:i:s') VBS WScript.Echo ("yyyy",Now()) & "." & Right("0" & DatePart("m",Now()), 2) & "."_ & Right("0" & DatePart("d",Now()), 2)& " " & FormatDateTime(Now(), vbLongTime) |
Simple and useful tool for creating timestamps in command line (batch). It need not fixed time format and is used current time zone.
Examples
for /f "tokens=1" %%a in ('timestamp.exe') do (
set timestamp=%%a
)
systeminfo > %timestamp%_%computername%.log
for /f "tokens=1-8 delims=- " %%a in ('timestamp.exe -d') do (
set year=%%a
set month=%%b
set day=%%c
set hour=%%d
set minute=%%e
set second=%%f
)
echo Now is %hour%:%minute%:%second% %month%-%day%-%year%
Download: timestamp.zip
Convert a NT system time (Integer8), in (10^-7)s intervals from 0h 1-Jan 1601, into a readable format. (pwdLastSet, lastLogon, etc)
w32tm /ntte %time%
Convert an NTP time, in (2^-32)s intervals from 0h 1-Jan 1900, into a readable format. (whenChanged, etc)
w32tm /ntpte %time%
Convert a datetime value to a NT system time (Opposite)
http://www.petri.co.il/software/datetointeger8.zip