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,448
88
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,391
99
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,340
149
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,448
88
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
294
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,340
149
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
Thread starter Title Forum Replies Date
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
Joe Caverly DATE format 4 Support 7
fpefpe touch - date format Support 2
mfarah Fixed The DATE command produces the wrong error message. Support 1
Jesse Heines How to? How to display picture creation date with dir command Support 6
Jesse Heines "Taken" date for JPG and PNG files Support 4
C 7zip with date range .vs. filelist created with dir and daterange Support 0
C How to? Add date/time to custom tpipe based BTM Support 1
vefatica Download center not up to date Support 4
Joe Caverly How to? Date Range in command line for 7zip /= Support 1
N date and cmd compatibility Support 10
rps Functions @year[date] @isowyear[date] help Support 7
S Closing date for V16 suggestions Support 1
JohnQSmith DATE /T Support 13
A How to? Create a date range based upon creation date Support 2
S How to? Command dialogs vs. size/date/etc. exclusion ranges Support 1
M How to? Effectively "combine" date and time ranges... Support 2
CWBillow Make a folder named Date-Time Support 18
vefatica Do UNTIL DATETIME date time Support 6
S Date range question Support 4
Roedy date range documentation error Support 2
Jay Sage Inconsistency in Date Formats Between @DATE and @MAKEDATE Support 3
dcantor More date-related help items for V11 Support 0
dcantor Help text for Date Formats Support 0
dcantor Suggestion for @DATE[] input Support 2
dcantor @DATE help example Support 0
CWBillow Date and Time in names Support 11
vefatica @TIMER's format ... Support 2
T Elapsed time format in prompt changed in TCC 25 Support 10
M Fixed Set "VAR=VAL" format causes problems Support 12
T Problems with the new help format Support 18
samintz WAD @format has issues in v18.00.14 Support 10
mikea How to? Detecting clipboard format Support 7
fishman@panix.com Help file in Kindle format? Support 5
M PDir format question... Support 3
A Is TCC help available in PDF format? Support 2
S TIME /S report format Support 3
S Vince - forum format revisited Support 1
D No "Format" in right-click menu for DVD Support 11
nikbackm Change format of DIR totals Support 3
C OT: Music file format checker Support 0
S Enhancement suggestion: @format and @formatn Support 0

Similar threads