Years ago in IB Staz had an article describing an easy way to look at dates,
age, etc.
I would like to use this simple code but have run into a problem if the date
of birth is below 1930. I'm not sure if the operating system has changed
some attributes or if I have misinterpreted the code. I suspect it is
me.....However, I THINK, that I will have a problem anyway since some of the
birthdays I will have to enter will be before 1904. Does anyone have a
solution.
Thanks, TJS
The old code is:
DIM RECORD gDateTimeRecord
DIM gYear
DIM gMonth
DIM gDay
DIM gHour
DIM gMinute
DIM Gsecond
DIM gDayOfWeek
DIM END RECORD _gDateTimeRecSz
END GLOBALS
LOCAL FN compressDate
gHour=0
gMinute=0
gSecond=1
longDate&=FN DATE2SECS (@gDateTimeRecord)
END FN=longDate&
gDay=19
gMonth=11
gYear=1930
'This is the problem...inaccurate if gYear<1930
firstDate&=FN compressDate
gDay=26
gMonth=1
gYear=1998
lastDate&=FN compressDate
seconds&=lastDate&-firstDate&
daysBetween=seconds&/86400
CLS
PRINT daysBetween
gYear=daysBetween/365
gMonth=daysBetween/30
SELECT daysBetween
CASE=>730
PRINT gYear
CASE ELSE
gYear=2
LONG IF gMonth<24
PRINT gMonth
XELSE
PRINT gYear
END IF
END SELECT
INPUT"";A$