home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY2 / TODAY.ZIP / TODAYU.BAS < prev    next >
BASIC Source File  |  1990-02-19  |  2KB  |  73 lines

  1. $compile UNIT
  2. '(C) 1987-90 Barry Erick
  3. ' Other than this being a UNIT, there are no differences from the
  4. ' TB version
  5. 'any External MUST be made PUBLIC in the Main unit, even if not used
  6. 'Always let the user know what the variables are if the unit is supplied
  7. 'without a demo main
  8. EXTERNAL wk$,dm$,month$,year$
  9.  
  10. SUB GetTodaysdate PUBLIC     'make it accessable to the main
  11.  local wkdy%,Dat%,Mont%,yea%
  12.  REG 1,&H2A00
  13.  CALL INTERRUPT &H21
  14.  wkdy%= REG(1) MOD 256    'AH
  15.  Dat% = REG(4) MOD 256    'DH
  16.  Mont%= REG(4)\256        'DL
  17.  yea% = REG(3)            'CX
  18.  SELECT CASE wkdy%
  19.         CASE 0
  20.              WK$ = "Sunday"
  21.         CASE 1
  22.              WK$ = "Monday"
  23.         CASE 2
  24.              WK$ = "Tuesday"
  25.         CASE 3
  26.              WK$ = "Wednesday"
  27.         CASE 4
  28.              WK$ = "Thursday"
  29.         CASE 5
  30.              WK$ = "Friday"
  31.         CASE 6
  32.              WK$ = "Saturday"
  33.  END SELECT
  34.  SELECT CASE dat%
  35.         CASE 1,21,31
  36.              Dm$ = STR$(dat%)+"st"
  37.         CASE 3,23
  38.              Dm$ = STR$(dat%)+"rd"
  39.         CASE 2,22
  40.              Dm$ = STR$(dat%)+"nd"
  41.         CASE ELSE
  42.              Dm$ = STR$(dat%)+"th"
  43.  END SELECT
  44.  SELECT CASE Mont%
  45.         CASE 1
  46.              Month$ = "January"
  47.         CASE 2
  48.              Month$ = "February"
  49.         CASE 3
  50.              Month$ = "March"
  51.         CASE 4
  52.              Month$ = "April"
  53.         CASE 5
  54.              Month$ = "May"
  55.         CASE 6
  56.              Month$ = "June"
  57.         CASE 7
  58.              Month$ = "July"
  59.         CASE 8
  60.              Month$ = "August"
  61.         CASE 9
  62.              Month$ = "September"
  63.         CASE 10
  64.              Month$ = "October"
  65.         CASE 11
  66.              Month$ = "November"
  67.         CASE 12
  68.              Month$ = "December"
  69.  END SELECT
  70.  Year$ = RIGHT$(STR$(yea%),4)
  71.  
  72. END SUB
  73.