Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Date format date different from cmd

Oct
23
0
Hi,

On one of my Take Command instances, the date /t command returns dd/mm/yyyy, while cmd returns mm/dd/yyyy.

On another instance, tcc returns the same as dos, mm/dd/yyyy.

How can I coax tcc to inherit the dos format, mm/dd/yyyy?
 
Huh. DATE /T here returns "Fri 13/11/2020", even though my local short date format is M/d/yyyy. DATE really should be using the local date format. Never noticed that — I never use DATE /T for anything.

According to the help file, there's a /F option to specify the date format. That doesn't seem to do anything for me.
 
I get

Code:
v:\> date /t
Fri 13-11-2020

My system short date is YYYY-MM-DD. At least it's using the hyphen for me and the slash fou you, Charles! :smile:
 
Yes, it looks like it's picking up the date separator char from the format picture. And nothing else.
 
DATE does not use the Windows date formatting string (it used to years ago and we got constant complaints from people who didn't like the default Windows string but didn't want to change it).

You can use the /Fn option to choose from some predefined formats; If you want a custom format, DATE supports any conceivable format you can imagine.
 
I figured out what I was doing wrong earlier: I was putting a colon between the /F and the number. Without the colon /F works as documented.

Code:
C:\>ver /r

TCC  26.02.42 x64   Windows 10 [Version 10.0.17763.1518]
TCC Build 42   Windows 10 Build 17763
Registered to COE-LN00061392

C:\>date /t
Sun 15/11/2020

C:\>date /t /f0
Sun  Nov 15, 2020

C:\>date /t /f1
11/15/20

C:\>date /t /f2
Sun 15/11/2020

C:\>date /t /f3
Sun 15/11/2020

C:\>date /t /f4
2020-11-15

C:\>

It still looks odd to me. May I suggest a format 3, like format 2 only with the month and day swapped?
 
You can use the /Fn option to choose from some predefined formats; If you want a custom format, DATE supports any conceivable format you can imagine.

Which are... ? Help only shows four as predefined in /F (and I'd kinda like to know what shiRt I can pull that DATE will accept, if only to keep up with the dumb things some people on certain workplace do to represent dates in our (I mean, someone's) database.


While we're at it.... since NTFS has supported milliseconds in the timestamp for a long time now, will TIME take milliseconds as well?
 
Which are... ? Help only shows four as predefined in /F (and I'd kinda like to know what shiRt I can pull that DATE will accept, if only to keep up with the dumb things some people on certain workplace do to represent dates in our (I mean, someone's) database.

DATE supports all of the custom format strings that @DATEFMT supports. See the help for @DATEFMT for details.
 

Similar threads

Back
Top