I must be missing something, as I can't get custom formats to work with the Date command. Reading the help page, I though that putting the format in quotes would change the display, but I am obviously wrong. Here are my tests:
C:\ > date /t "YY-MM-DD"
Sun 24/01/2021
C:\ > date /t "%%A"
Sun 24/01/2021
but I can't figure out how to display the date in a custom format. I would bet that I'm misunderstanding the documentation, but I would appreciate if someone could please post an example for me. Thank you in advance.
It confused me too; this feature could certainly stand to be better documented. It turns out that you aren't supped to combine the custom format string with any other options:
I don't think that the /u switch gives the incorrect time. On my system here outside of Boston, MA and therefore in EST, /u gives the correct time in GMT. But notice that if I use both /t and /u, the time is not displayed.
Code:
C:\\ > date
Sun 24/01/2021 21:01:08
New date (mm-dd-[yy]yy):
C:\\ > date /u
Mon 25/01/2021 02:01:12
New date (mm-dd-[yy]yy):
C:\\ > date /t /u
Mon 25/01/2021
Thus, the /t switch seems to have more consequences than just suppressing the prompt for a new date. Is that a bug? If not, I believe that the documentation for the Date command needs to be updated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.