Request for TCC Date Command Custom Format Example

Aug 16, 2016
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
The /f switch does work:
C:\\ > date /t /f0
Sun Jan 24, 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:

C:\>date "%%Y:%%m:%%d [%%a]"
2021:01:24 [Sun]


It looks like you can combine it with /U, but for me that gives an incorrect result:

C:\>date /u "%%c"
1/24/2021 1:12:55 AM


The time is correct, but the date should be the 25th.

(I assume you're using the paid version. This feature is not available in TCC/LE.)
"/U" doesn't do anything for time with a custom format.

v:\> time "%%T"

v:\> time /u "%%T"
C:\>date "%%T"

C:\>date /u "%%T"

C:\>time "%%T"

C:\>time /u "%%T"


It does something in DATE. Maybe not the Right Thing, but something.
Thank you, Charles. Yes, I have a license for TCC 27.00.16 x64.

Your example is very interesting. But note that the /t switch causes the custom format to be ignored. This isn't mentioned in the documentation.
C:\\ > date "%%A"

C:\\ > date /t "%%A"
Sun 24/01/2021
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.
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.

Thank you again for your help.

Similar threads