View Full Version : Date calculation/Leap Years/Year 2000
05-08-2002, 08:32 AM
Hmmm, I believe the number 37314 is correct. Remember, 1900 was not a leap year, but 2000 was.
05-08-2002, 09:50 AM
Or maybe you're counting Jan 1 1900 as one of the days.
05-08-2002, 11:01 AM
I agree that 37314 is correct since 1900 was not a leap year. So for the century Jan 1 1900 through Jan 1 2000 there were 36524 days (24 leap years, 76 non-leap years). Add the 366 days for 2000 and 365 for 2001 and the 59 days for Jan and Feb 2002 that should give 37314. "Always show your work, not just the answer" (my science teacher would be proud).
05-09-2002, 12:07 AM
I've now modified the code to count the days from 31st December 1899, since I need to count 1st January 1900. Thanks for your help! Kate
05-09-2002, 05:30 AM
To elaborate: LeapYear = %rem(Year:4) = 0 AND NOT (%rem(Year:100) = 0 AND %rem(Year:400) > 0);
05-09-2002, 05:32 AM
I had to convert a date from standard YYYYMMDD format to number of days since 1900, and found something which puzzles me: 1st March 2002 is 37315 days since 1st January 1900, but when I debugged the code below, the result field was 37314. <center> *eur movel 01011900 hyfbeg </center> * <center> cald subdur hyfbeg hyf:*days </center> (cald is 01032002) It was suggested to me that this could be errors with leap year calculation, that the year 2000 was a leap year when some say that mathematically speaking, it shouldn't have been. Or am I just talking rubbish and producing malfunctioning code?! Cheers Kate
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.