:
This message was edited by DrMarten at 2006-6-6 3:19:12
:
: 38875/365= 106.50684931 50684931 50684931 50684931
:
: Take the integer 106 and add it onto 1900 gives 2006.
:
: 1900+106=2006
:
: Take the remainder or MOD of 38875/365 = 185
:
: i.e. 38875 mod 365 = 185
:
: now subtract the number of leap years from 1900 till now
inclusive.
: This is 27 as 1900 was a leap year, as was 2000.
:
: ( I had heard if a year ends with just 2 noughts like 1900 it's not counted as a leap year<>somewhere? Not sure on that one :-| )
:
: So getting back then...>
:
: 185-27=158.
:
: Now from this we must subtract 1 as Jan 1st 1900 was day zero.
:
: Microsoft like to start counting from zero for some functions ( but not all, some in VB.Net start at 1 ).
:
: So 157 then is the 157th day of this year or 6/06/2006.
:
: 31 (Jan) + 28 (Feb) + 31 (March) + 30 (April) + 31 (May) + 6 = 157.
:
:
: Summary:>
:
: Dim NoOfYears, remainingDays, newRemainingDays As Integer
: NoOfYears=38875\365 '= NoOfYears to add to 1900.
: 'Reverse slash or \ is integer division.
:
: remainingDays=38875 mod 365 '= remainingDays
:
: 'Deduct leap years since 1900 including 1900 inclusive
: '...in other words.
: 'You can get the 27 by ((year-1900)\4)+1
: 'E.G. ((2006-1900)\4)+1 = 27
: 'You could add 2 instead to give the FINAL answer,
: 'if you do then DELETE the RED line of code below.
: 'What this will do is make the sum>>
: '((2006-1900)\4)+2 = 28
:
: 'I don't think INTEGER DIVISION rounds up.
:
: newRemainingDays=remainingDays-27
: newRemainingDays=newRemainingDays-1
:
: 'newRemainingDays =157 this is the day number in the year.
:
:
:
: Regards,
:
: Dr M.
:
: P.S. The Adjust time/date function on a PC goes up to 31/12/2099, i think most of dont want to live to see that day anyway ( we'll be too old or pushing up daisy's ).
:
:
:
:
tkx a lots...
George