Re: Date Routine Question

 BBS: Inland Empire Archive
Date: 04-16-92 (16:48)             Number: 112
From: DICK DENNISON                Refer#: NONE
  To: GARY POOL                     Recvd: NO  
Subj: Re: Date Routine Question      Conf: (2) Quik_Bas
GP> Does anyone have a good routine that will tkell the day of
GP> the week from the date?  (Sorry, a lot of line noise today).

GP> For example, Call DayOfWeek$(Date$) would call a Function DayOfWeek$
GP> that would return Monday, Tuesday, Wednesday, etc.  A friend of mine d
GP> it in assembler on the host, but if I ask him for the algorithm, he wi
GP> harrass me to no end.  I'm sure that this is something that has been
GP> done many times before, so I'd rather not reinvent the wheel.  Thanks
GP> advance.  gp


'Try this:

'Day of Week - Dick Dennison 10/26/89
'$INCLUDE: 'qb.bi'    'load qb with the /L switch
'Interrupt 21 Function 2AH - get date
DIM InRegs AS RegType, OutRegs AS RegType
DIM Day(7) AS STRING * 3
Day$(0) = "Sun": Day$(1) = "Mon": Day$(2) = "Tue": Day$(3) = "Wed"
Day$(4) = "Thu": Day$(5) = "Fri": Day$(6) = "Sat"
CLS
InRegs.ax = &H2A * 256   '2Ah in ah
CALL INTERRUPT(&H21, InRegs, OutRegs)
' * * * cx is the year, dh is the month, dl is the date, al is the day
PRINT OutRegs.cx; " = year"
PRINT OutRegs.dx \ 256; " = month"
PRINT OutRegs.dx MOD 256; " = date"
daynum% = OutRegs.ax MOD 256
PRINT "Day of the week is "; Day$(daynum%)


--- VP [DOS] V4.09e
 * Origin: New York Quick Share Point * HST (914)374-3903 (1:272/34)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET