1. Re: Date Info Needed
If you want to know the current time and date use date(), see below.
To calculate the day of a week from a date see this in the archive (Under extra
stuff from RDS)
Date calculations 1K Junko Miura Sep 1/96
A program for calculating the day of the week, given the date. It also
calculates the number
of days between any two dates. @
http://members.aol.com/fileseu/daybdate.zip
To ceck the validatey of a date or if a year is a leap year see (Under Recent
Contributions)
Useful Routines 24K Mathew Hounsell updated Apr 4/99
Mathew Hounsell wrote these routines for memory addressing, file path
manipulation, date
validation, finding elements, program information, sequence manipulation,
benchmarking and
determining an objects size, as well as constants for BIOS fixed
addresses.
http://members.wbs.net/homepages/f/i/l/fileseu/cil.zip
Other wise it's...
-- Untested Code
sequece regs = repeat(0,10)
regs[REGS_AX] = #2A
regs = dos_interrupt( 21, regs )
day = and_bits( regs[REGS_AX], #FF )
year = regs[REGS_CX] + 1980
month = floor( regs[REGS_DX] / #100 )
dow = and_bits( regs[REGS_DX], #FF )
to use...
DOS GET DATE ( SET DOS DATE INT 21 2B )
INT21 FUNCTION 2A { USES SAME REGISTERS )
RETURNS:
AL = DAY
CX = YEAR ( 1980 - 2099 )
DH = MONTH
DL = DAY OF THE WEEK ( 0 = SUNDAY )
Most modern bioses store the number of days since 1980 in 2 Bytes @ 0040:00CE
constant CLOCK_DAYS_SINCE_1980 = #4CE -- Days since 1980 (In
BIOS_MEM.E)
ds1980 = peek( CLOCK_DAYS_SINCE_1980 )
The date() function
Syntax:
s = date()
Description:
Return a sequence with the following information:
{ year, -- since 1900
month, -- January = 1
day, -- day of month, starting at 1
hour, -- 0 to 23
minute, -- 0 to 59
second, -- 0 to 59
day of the week, -- Sunday = 1
day of the year} -- January 1st = 1
Example:
now = date()
-- now has: {95,3,24,23,47,38,6,83}
-- i.e. Friday March 24, 1995 at 11:47:38pm, day 83 of the year
Comments:
The value returned for the year is actually the number of years
since 1900 (not the
last 2 digits of the year). In the year 2000 this value will be 100.
In 2001 it will
be 101, etc.
-------------------------
Sincerely,
Mathew Hounsell
mat.hounsell at excite.com