DateTimeUTC – Version 1.1

I’ve been using DateTimeUTC for quite some time in batch files to get a nicely formatted date.

This is the first major revision of DateTimeUTC where you can now add or subtract from the current date. This is very useful if you want yesterday’s date.

Get the latest version from here: DateTimeUTC

The main usage of the application is:

datetimeutc [-options]

-fFORMAT Set output format
-z Set output time to Local Time (Not UTC)
-help View full online help

Example formats:
yyyyMMddTHHmmssZ 20081121T100227Z
“yyyy-MM-dd HH:mm:ss UTC” 2008-11-21 10:02:27 UTC
“dd MMMM yyyy” 21 November 2008
ddd Fri
dddd Friday
fff (Milliseconds)

Use double quotes when the format includes a space
Use backslashes to escape reserved character

Now, to add or subtract from the time, the format of the option is:
[timeunit] is one of YMdHms for Year, Month, Day, hour, Minute or Second
[value] is an integer and can be positive or negative

The following will print the UTC time one day ago:
datetimeutc -fyyyyMMddTHHmmssZ -d-1

Do get the output into a batch file, try this:
for /f “usebackq” %%a in (`datetimeUTC.exe -fyyyyMMddTHHmmssZ`) do (set UTCdts=%%a%)
echo %UTCdts%

Job done

You May Also Like

About the Author: John

Leave a Reply

Your email address will not be published. Required fields are marked *