TIME.BAS
Timeshared BASIC provided a basic set of time and date functions. This program uses those functions to produce readable time and date strings. Note that this program is not Y2K compliant.


10  REM *System TIME program - Dan Veeneman  5/20/80 *
20  DIM H$[2],P$[5],M$[130]
30  DIM T1$[2],U1$[2],V1$[2],C$[12]
40  C$="  :  :  "
50  REM  set up minutes
60  M=TIM(0)
70  REM  set up the hour
80  H$="AM"
90  H=TIM(1)
100  IF H<12 THEN 140
110  H$="PM"
120  IF H=12 THEN 140
130  H=H-12
140  REM  set up seconds
150  S=TIM(4)
160  REM  set up year
170  Y=TIM(3)
180  Y=Y+1900
190  REM  set up day name
200  DIM M1$[70],R$[10]
210  L1=4
220  FOR D1=70 to TIM(3)-1
230  IF D1/4#INT(D1/4) THEN 250
240  L1=L1+1
250  NEXT D1
260  C1=Y-1970+L1
270  M1$="Monday    Tuesday   Wednesday Thursday  Friday    Saturday  Sunday    "
280  C1=C1-(INT(C1/7)*7)
290  D5=TIM(2)+C1-1
300  D5=D5-(INT(D5/7)*7)
310  R$=M1$[D5*10-9,D5*10]
320  R$=R$[1,POS(R$," ")-1]
330  REM  set up month
340  R=0
350  REM  month SBR
360  DIM D[12]
370  D[1]=D[3]=D[5]=D[7]=D[8]=D[10]=D[12]=31
380  D[2]=28
390  IF TIM(3)/4#INT(TIM(3)/4) THEN 410
400  D[2]=29
410  D[4]=D[6]=D[9]=D[11]=30
420  FOR I=1 TO 12
430  R=R+D[I]
440  IF TIM(2) <= R THEN 480
450  NEXT I
460  PRINT " Big problem"
470  STOP
480  M$="January  February March    April    May      June     July     August   SeptemberOctober  November December "
490  M1$=M$[I*9-8,I*9]
500  P4=POS(M1$," ")
510  IF P4#0 THEN 530
520  P4=9
530  M$=M1$[1,P4]
540  R=TIM(2)-(R-D[I])
550  CONVERT R TO M$[LEN(M$)+1,LEN(M$)+3]
560  CONVERT H TO C$[1,2]
570  CONVERT M TO C$[4,5]
580  CONVERT S TO C$[7,8]
590  FOR X=2 TO 8 STEP 3
600  IF C$[X,X]#" " THEN 630
610  C$[X,X]=C$[X-1,X-1]
620  C$[X-1,X-1]="0"
630  NEXT X
640  REM  printout
650  PRINT "Current time: ";C$;" ";H$
660  PRINT "Current date: ";R$;", ";M$;Y
670  END


Comments to Webmaster

Click here for the Home page.
Click here for the HP-2000 page.
Click here for the Wanted page.

Last updated February 27, 2005