Computing.Net > Forums > Disk Operating System > date format in "prompt $d"

date format in "prompt $d"

Reply to Message Icon

Original Message
Name: Leonardo Zacche
Date: August 22, 2000 at 12:10:42 Pacific
Subject: date format in "prompt $d"
Comment:

People!

if I run the command "prompt $d", my dos prompt turns the actual date (no problem), but in the format dd/mm/yyyy.
I want to change to yyyy-mm-dd ("-", not "/"!!!) or yyyymmdd (without any separators!).

Is it possible?

Any help?

Thanks again!

LZ


Report Offensive Message For Removal

Response Number 1
Name: Laurence
Date: August 22, 2000 at 12:37:32 Pacific
Subject: date format in "prompt $d"
Reply: (edit)

Here is a batch to do this in MS-DOS 7.x which I don't use. I don't have time to write one for real DOS.

http://x63.deja.com/[ST_rn=ap]/threadmsg_ct.xp?AN=653595394.1&mhitnum=9&CONTEXT=966972539.2118713383

Here is the batch in case the url doesn't work.

:: NewDate1.bat - A Win 95/98 routine to parse date having the form
:: Dow mm-dd-yyyy (US)
:: Tom Lavedas
:: http://www.pressroom.com/~tglbatch/
@%5 echo %dbgn% off
for %%v in (md cd) do %%v @tmp@
echo @prompt rem$g"$d" > ~tmpA.bat
%comspec% /e:2048 /c ~tmpA.bat > ~tmpB.bat
for %%v in (~tmpB.bat del) do call %%v ~tmp?.bat
lfnfor on
for %%v in (*) do %0 %%v goto:2nd
%0 %%v goto:2nd
:2nd
lfnfor off
del "??? ?? ?? ????"
for %%v in (cd.. rd.\@tmp@) do %%v
set YYYY=%4
set MM=%2
set DD=%3
set DOW=%1
ren c:\path\MyFile.ext c:\path\%MM%-%DD%-%YYYY%.ext

(Snide comment aside: I thought to remove the last five lines and make the
last line read ...

ren c:\path\MyFile.ext c:\path\%2-%3-%4.ext

But that would have caused some people to ask how to use it.)

Tom Lavedas


Report Offensive Follow Up For Removal

Response Number 2
Name: Jon Fox
Date: August 22, 2000 at 13:45:30 Pacific
Subject: date format in "prompt $d"
Reply: (edit)

Unless I'm missing something here then
"country=002" in config.sys will work.
Of course that will change some other things as well.


Report Offensive Follow Up For Removal

Response Number 3
Name: Leonardo Zacche
Date: August 22, 2000 at 16:13:03 Pacific
Subject: date format in "prompt $d"
Reply: (edit)

It didn't worked yet! :-(

in my system, dates are displayed in the format dd/mm/yyyy (YES! WITH slashes!) but I can't create files using slashes ("/") in its names!

So I need a way to determine the current time (all parts together or not!) but, without using slashes!

That's why Laurence's tip (thanks!) didn't worked!
And, unfortunatelly, I can't change the settings of the machine!

Any other ideas?

Thanks again!

LZ


Report Offensive Follow Up For Removal

Response Number 4
Name: Laurence
Date: August 22, 2000 at 22:49:56 Pacific
Subject: date format in "prompt $d"
Reply: (edit)

There is usually always a third party utility available, although I prefer to avoid them.

http://www.online-club.de/~Eulenspiegel/english/date2.htm

If you set variables to the different parts, you can re-arrange them any way you like.


Report Offensive Follow Up For Removal

Response Number 5
Name: Laurence
Date: August 23, 2000 at 04:13:15 Pacific
Subject: date format in "prompt $d"
Reply: (edit)

BTW, this is really not difficult to write yourself, especially if it's for your own use and you don't need to check for various date formats. You first get the date into a variable and then parse it character by character setting variables for the individual parts as you go along.

Here is an excellent parsing routine which can very easily be used for this purpose:
http://home7.inet.tele.dk/batfiles/main/batchfaq.htm#31


Report Offensive Follow Up For Removal


Response Number 6
Name: Extract from MS-DOS 6 Res
Date: August 31, 2000 at 14:12:24 Pacific
Subject: date format in "prompt $d"
Reply: (edit)

The country code specifies the time and date formats used by the following MS-DOS commands: backup, date, restore, and time.

The following table lists the date and time formats related to each country code. For each country code, the “Date format” column shows how MS-DOS displays January 3, 1993, and the “Time format” column shows how MS-DOS displays 5:35 P.M. (with 0 seconds and 0 hundredths of a second).

Country Country code Date Time
Belgium 032 23/01/1993 17:35:00
Brazil 055 23/01/1993 17:35:00
Canadian-French 002 1993–01–23 17:35:00
Czechoslovakia 042 1993–01–23 17:35:00
Denmark 045 23–01–1993 17.35.00
Finland 358 23.01.1993 17.35.00
France 033 23.01.1993 17:35:00
Germany 049 23.01.1993 17:35:00
Hungary 036 1993–01–23 17:35:00
Int English 061 23–01–1993 5:35:00.00p
Italy 039 23/01/1993 17.35.00
Latin America 003 23/01/1993 5:35:00.00p
Netherlands 031 23–01–1993 17:35:00
Norway 047 23.01.1993 17:35:00
Poland 048 1993–01–23 17:35:00
Portugal 351 23–01–1993 17:35:00
Spain 034 23/01/1993 17:35:00
Sweden 046 1993–01–23 17.35.00
Switzerland 041 23.01.1993 17,35,00
United Kingdom 044 23/01/1993 17:35:00.00
United States 001 01–23–1993 5:35:00.00p
Yugoslavia 038 1993–01–23 17:35:00


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: date format in  "prompt $d"

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software