Compucolor.org – Virtual Media

Listing of file='DATE.BAS;01' on disk='vmedia/chip_128-sector.ccvf'

1000 REM  SUBROUTINE TO CONVERT A STRING FOR A DATE TO A
1010 REM     NUMERIC COMPUTER USABLE FORMAT (YYMMDD)
1020 REM
1030 REM   ENTER ROUTINE WITH DT$, ROUTINE RETURNS DT
1040 REM
1045 REM   TEMPORARY VARIABLES: D0,D1,D2,D3,D1$,D2$,D3$
1050 REM
1060 REM  THIS ROUTINE WILL ACCEPT THE FOLLOWING FORMATS:
1070 REM
1080 REM       YYMMDD       YY/MM/DD      YY:MM:DD
1090 REM       MMDDYY       MM/DD/YY      MM:DD:YY
1100 REM                    M/D/YY        M:D:YY
1110 REM
1120 REM  THE ONLY LIMITATION IS THAT THE YEAR CANNOT BE LESS
1130 REM                     THAN '12'!
1150 REM
1160 REM
10000 REM  ********  SUBROUTINE STARTS HERE  ***************
10010 D3= 0
10020 FOR D0= 1TO LEN (DT$)
10030  IF ASC (MID$ (DT$,D0,1))< 48THEN D3= 1:D0= LEN (DT$)
10040 NEXT D0
10050 IF D3= 1GOTO 10090
10060 IF VAL (LEFT$ (DT$,2))> 12THEN DT= VAL (DT$):RETURN
10070 DT= VAL (RIGHT$ (DT$,2)+ LEFT$ (DT$,4))
10080 RETURN
10090 FOR D0= 1TO 3
10100 IF ASC (MID$ (DT$,D0,1))< 48THEN D1= D0
10110  IF ASC (MID$ (DT$,(LEN (DT$)- D0)+ 1,1))< 48THEN D2= (LEN (DT$)- D0)+ 1
10120 NEXT D0
10130 D1$= RIGHT$ ("00"+ LEFT$ (DT$,D1- 1),2)
10140 D2$= RIGHT$ ("00"+ MID$ (DT$,D1+ 1,(D2- D1)- 1),2)
10150 D3$= RIGHT$ ("00"+ RIGHT$ (DT$,LEN (DT$)- D2),2)
10160 IF VAL (D1$)> 12THEN DT$= D1$+ D2$+ D3$:DT= VAL (DT$):RETURN
10170 DT$= D3$+ D1$+ D2$:DT= VAL (DT$):RETURN