Path: utzoo!attcan!uunet!mcvax!ukc!reading!cf-cm!cybaswan!iiit-sh From: iiit-sh@cybaswan.UUCP (Steve Hosgood) Newsgroups: comp.binaries.ibm.pc.d Subject: Re: Good date programs Message-ID: <459@cybaswan.UUCP> Date: 24 May 89 13:19:14 GMT References: <1163@marlin.NOSC.MIL> <2219@uwovax.uwo.ca> Reply-To: iiit-sh@cybaswan.UUCP (Steve Hosgood) Organization: Institute for Industrial Information Technology Lines: 41 In article <2219@uwovax.uwo.ca> 13001_6035@uwovax.uwo.ca writes: >In article <1163@marlin.NOSC.MIL>, jbjones@marlin.NOSC.MIL (John B. Jones) writes: >> I need a nice date program which I can use at the command line, which >> won't expect a return or prompt me for a change, and which displays the >> date and the day of the week. The output will probably look like this: >> >> May 16, 1989 Tuesday >What follows is what I think is a more efficient way of displaying >the time and the date under DOS 3.3. Somehow I think this is a more >elegant approach than piping DATE and TIME into FIND. > >-----SHOWDT.BAT BEGINS-----CUT HERE----- > [ .BAT routine deleted ] All this seems rather over-complicated to me. I wrote a short routine along the lines of UN*X's 'date' program in Microsoft 'C'. This I called 'date.c' and compiled it to give myself a 'date.exe'. I then hacked 'command.com' with 'debug' and changed the string 'DATE' to 'DSET' and 'TIME' to 'TSET' in the list of built-in commands. This allows 'date.exe' to be run. The source of date.c is at home, but it's pretty much a 6-liner: # include main() { printf("%s", asctime(time(( long * ) 0))); exit(0); } ....or something like that. You can fiddle with the string returned by 'asctime' before printing it if you want to change the format a bit. I did something similar to give myself a more UN*X-like 'cd' program without the EVIL backslash seperator that DOS cripples you with. It's amazing how much more pleasant it is to work on MSDOS after this sort of surgery. Steve