BBS: Inland Empire Archive Date: 12-13-92 (02:03) Number: 294 From: JOE NEGRON Refer#: NONE To: BOB OEHRLE Recvd: NO Subj: Date$ ??? Conf: (2) Quik_Bas
BO> While in Dos if I call for the date I get Wed-12-12-92. If I print > date$ in qb4.5 I get 12-12-92. Is there away that I can get the days > to print ?? It seems that if I use Mid$ function I can't extract Wed . > I'm trying to write a calendar routine that will alert me at start up > every wednesday to preform a particular job. > Bob in NJ BASIC's DATE$ function does not return the day of the week. The following does: ============================== Begin code ============================== DEFINT A-Z '$INCLUDE: 'qbx.bi' DECLARE FUNCTION DOW$ () PRINT DOW$ SYSTEM '*********************************************************************** '* FUNCTION DOW$ '* '* PURPOSE '* Uses DOS ISR 21H, Function 2AH (Get Date) to return the current '* day of the week. '* '* EXTERNAL ROUTINE(S) '* QBX.LIB '* ------- '* SUB Interrupt (IntNum%, IRegs AS RegType, ORegs AS RegType) '*********************************************************************** FUNCTION DOW$ STATIC DIM IRegs AS RegType, ORegs AS RegType IRegs.ax = &H2A00 'Function 2AH (Get Date) Interrupt &H21, IRegs, ORegs 'Call DOS al% = ORegs.ax AND &HFF 'extract al register DOW$ = MID$("SunMonTueWedThuFriSat", (al% + 1) * 3 - 2, 3) END FUNCTION =============================== End code =============================== If you are using QB 4.5, replace "'qbx.bi'" with 'qb.bi'. You must also start QB up with the following command: C:\>qb /l Of course, this will only work if you want the *current* day of the week. If you want to get the day of the week for dates other than the current date, you need to use what are called "serial" dates; what you do, in essence, is to convert the date into a serial ("in sequence") number. Once you have done that, you can do all sorts of calculations on it. --Joe in Bay Ridge, Brooklyn, NY-- Sun 12-13-1992, 02:01 * SLMR 2.1a * Tagline Subsystem down at this time... --- Maximus 2.01wb * Origin: * BlueDog BBS * (212) 594-4425 * NYC FileBone Hub (1:278/709)
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