Page 2 of 2

Posted: Fri Feb 24, 2006 4:26 pm
by Dare2
Hi buzzqw,

As Behnood and Jan Vooijs have just explained to you and me, there is a base date of 1970.

So all calculations are based on seconds since the start of 1970. That means you need to get the year and subtract 1970.



@Jan,

Turbo pascal! Real programmers coded in BasicA! :P ;)

Posted: Fri Feb 24, 2006 5:24 pm
by Jan Vooijs
Dare2,

Well BasicA did not have the date calculus!! So :P I used TP (from 1.0 till 7.0 allthough tje latter was BP not TP)

Subtracting 1970 from the date is a bit of a problem since it is a string!!! Better would be an other function. Or this way:

Code: Select all

date1=ParseDate("%yyyy/%mm/%dd", "2004/03/01")
date2=ParseDate("%yyyy/%mm/%dd", "2006/01/24")
date_bet=date2-date1

Debug date_bet


Text.s = FormatDate( "%yyyy/%mm/%dd", Date_bet)

Debug Text.s


Debug Year( Date_bet) - 1970
Debug Month( Date_Bet)
Debug Day( Date_bet) 

; or :

Debug "Years...: " + Str( Year( Date_bet) - 1970)
Debug "Months..: " + Str( Month( Date_Bet))
Debug "Days....: " + Str( Day( Date_bet))
Cheers,

Jan V.

Posted: Fri Feb 24, 2006 6:08 pm
by Behnood
@buzzqw
why you tried to subtract 1/1/1970?! cause i think date() will return zero for that date (it's the base date) so how many seconds past after 1/1/1970 until 1/1/1970? sure zero (infact it's what i think must be)

Posted: Fri Feb 24, 2006 7:20 pm
by buzzqw
:thanks: !!! to ALL !!!

BHH