page 60,132 name yymmdd title YYMMDD 1.5 Comment û Please report bugs and problems to: Roedy Green Canadian Mind Products #101 - 2536 Wark Street Victoria, BC Canada V8T 4G8 tel:(250) 361-9093 mailto:roedyg@mindprod.com http://mindprod.com YYMMDD.com Displays date in form YY-MM-DD without a CrLf You can put an optional separator on the command line. If you wanted ISO 8601:1988 international standard yy-mm-dd format, n the command line, or in a bat file type: YYMMDD - gives 00-12-31 YYMMDD none gives 001231 YYMMDD space gives 00 12 31 YYMMDD . gives 00.12.31 YYMMDD / gives 00/12/31 YYMMDD gives 00-12-31 Version history 1.0 1991-12-20 - released on BIX 1.1 1993-06-11 - new address 1.2 1996-10 25 - embed POB 707 Quathiaski Cove address 1.3 1998-11-08 - embed Barker address 1.4 2001-01-05 - add optional separator on command line 1.5 2009-03-13 - add ANT build script. change default from / to . - bundled with YYYYMMDD ;============================================================== ; R E G I S T E R C O N V E N T I O N S Subroutines may trash any registers they please except CS: DS: ES: SS: and of course the outputs. û ; end of comment ;============================================================== stack segment stack ; keep MS link happy by providing null stack stack ends ;============================================================== CODE segment PARA ; start off in code. ;============================================================== data segment word ; provide a separate DATA segment ; Even though it appears in the source ; before the code, it the COM file it ; will appear at the end. This is as dodge ; to avoid forward references that confuse ; MASM. Separator db '-','$' ; separator we use on date, - is is iso default ;"$$" means none. ; embedded but not displayed CopyrightMsg label byte db 13,10 db '°±²Û YYMMDD 1.5 Û²±°',13,10 db 'Copyright: (c) 1991-2017 Roedy Green, Canadian Mind Products',13,10 db '#101 - 2536 Wark Street, Victoria, BC Canada V8T 4G8',13,10 db 'tel:(250) 361-9093 mailto:roedyg@mindprod.com http://mindprod.com',13,10 db 'May be freely distributed and used for any purpose except military.',13,10 db '$' Data ends ;============================================================== com group code,data ; force data segment to go at the end assume CS:com,DS:com,ES:com,SS:com ; seg regs cover everything org 100H ; in Code segment ;============================================================== ; P R O C E D U R E S Main proc near ; see page 384 Ray Duncan's Advanced MS DOS call getSep ; decide on separator to display date with. mov ah,02ah ; get date DOS function int 21h ; year is returned in CX ; month is returned in DH ; Day is returned in DL mov ax,cx ; display year mov cx,2 ; only 2 low order digits call SayNDigits call SaySep ; separate YY-MM sub ax,ax ; display month, 2 digits mov al,dh mov cx,2 call SayNDigits call SaySep ; separate MM-DD sub ax,ax mov al,dl ; display day of month, 2 digits mov cx,2 call SayNDigits mov ax, 4c00h ; ERRORLEVEL = 0 int 21h ; normal exit to dos Main endp ;============================================================== include ymdinc.asm ;============================================================== CODE ends ; end of code segment end Main