home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-03-04 | 2.7 KB | 96 lines | [TEXT/TPAS] |
- program MilDate;
-
- {
- Written by: Stephen Kurtzman
- Very slightly modified by Brian Liebowitz...Steve got it right for the
- DHDR's that he was using, so if it doesn't work it's my fault.
-
- Public distribution is neither prohibited nor discouraged. Hell, you
- don't even have to keep our names on it.
-
- This function returns the military date format for the integer
- time/date
- specification passed. the integer is encoded as number of seconds since
- midnight, 01-Jan-1904. For more information on the system routines
- used
- in this procedure, see page 380 of Inside Macintosh, V II.
-
- You must install the DHDR resources called PasXFCN and PasXCMD
- into your copy of Turbo before compiling this XCMD. You must also
- have compiled the unit HyperXCMD and moved it into the Turbo progam,
- and the file XCMDGlue.inc must be accessible. After compiling,use
- ResEdit to change the ID from 300, and to copy the XCMD or XFCN into
- your stack or Hypercard.
- }
-
- {$R-} { turn off index checking }
- {$U-} { don't let Turbo give us units by default }
- {$D PasXFCN} { tell Turbo to create an XFCN resource }
-
- USES Memtypes, Quickdraw, OSIntf, HyperXCmd;
-
- PROCEDURE PasXFCN(paramPtr: XCmdPtr);
-
- VAR
- seconds, tempint: longint;
- str: Str255;
- date: DateTimeRec;
- monstr: string[3];
-
- {$I Xcmdglue.inc} {include the Pascal glue procedures}
-
- BEGIN
-
- { the first parameter is the date/time integer specification }
-
- ZeroToPas(paramPtr^.params[1]^,str);
- seconds := StrToNum(str);
-
- { if the specification is zero, then get the current }
-
- if seconds = 0 then GetDateTime(seconds);
-
- { convert the date specification to a date/time record }
-
- Secs2Date(seconds,date);
-
- { convert integer to long integer }
-
- tempint := Ord4(date.day);
-
- { encode the day of the month as a two character string }
-
- str := Concat(LongToStr(tempint div 10),LongToStr(tempint mod 10));
-
- { select the proper three character month string }
-
- case date.month of
- 1: monstr := 'Jan';
- 2: monstr := 'Feb';
- 3: monstr := 'Mar';
- 4: monstr := 'Apr';
- 5: monstr := 'May';
- 6: monstr := 'Jun';
- 7: monstr := 'Jul';
- 8: monstr := 'Aug';
- 9: monstr := 'Sep';
- 10: monstr := 'Oct';
- 11: monstr := 'Nov';
- 12: monstr := 'Dec'
- end;
-
- { put it all together and return the string to hypercard }
-
- paramPtr^.returnValue := PasToZero(Concat(str,'-',monstr,'-',
- LongToStr(Ord4(date.year))))
-
- END;
-
- BEGIN
- END.
-
- (*Remember to change the ID of this resource from 300*)
-
-
-
-