Date format date different from cmd

Oct 15, 2011
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?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,353
82
Albuquerque, NM
prospero.unm.edu
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.
 
May 20, 2008
11,019
88
Syracuse, NY, USA
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:
 

rconn

Administrator
Staff member
May 14, 2008
12,161
140
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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,353
82
Albuquerque, NM
prospero.unm.edu
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?
 
Nov 2, 2009
282
6
Chile
www.farah.cl
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?
 

rconn

Administrator
Staff member
May 14, 2008
12,161
140
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.
 
Thread starter Similar threads Forum Replies Date
samintz Support 2
Joe Caverly Support 7
fpefpe Support 2
Jay Sage Support 3
dcantor Support 0