View previous topic :: View next topic
|
Author |
Message |
tony01 Currently Banned New User
Joined: 14 Sep 2005 Posts: 9
|
|
|
|
DavidatK:
I tested year 2000 (leap year) for December 3th, 2000
I got weeknum = 49, which is wrong , should be weeknum = 48
December 30th, 2000
I got 2001-01, which is wrong , should be 2000-52
December 31st, 2000
I got 2001-01, which is wrong , should be 2000-52
In fact the code is NOT STABLE, I think is missing more logic, but should be tricki.
Anayway, still looking a TRUE solution.
Thanks
|
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Tony01,
I've got to stand by this code being correct. I even backloaded the code I posted and compiled that. Results of that test are:
Code: |
.20001201 = 2000-48
.20001202 = 2000-48
.20001203 = 2000-48
.20001204 = 2000-49
.20001205 = 2000-49
.20001229 = 2000-52
.20001230 = 2000-52
.20001231 = 2000-52
.20010101 = 2001-01
|
Methinks you missed something when you copied the code
What compiler are you using?
Dave |
|
Back to top |
|
|
tony01 Currently Banned New User
Joined: 14 Sep 2005 Posts: 9
|
|
|
|
Hi Dave:
In fact, I am working with Mainframe os/390, but the problem I think is that I don't have the FUNCTION INTGER-OF-DATE , so I am using a home routine to calculate INTEGR-OF-DATE, maybe this is the problem.
I am not sure of that.
Thanks |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Tony01,
One of the common problems with calculating the integer-of-date is that most applications are concerned with the number of days between two given dates within a normal business environment, where you are normally not concerned with dates prior to 1901 or after 2099 and are not concerned with the day of the week. The error usually comes in when calculating leap-years. Normally we consider a leap year to be a year evenly divisible by 4, and for the year between 1901 and 2099 this is true. However, if the year is evenly divisible by 100 and not evenly divisible by 400, it is NOT a leap year. Hence, 1600, 2000, 2400 are leap years, 1700, 1800, 1900, 2100 are NOT leap years. If this is not taken into account and your base year is prior to 1901, the day of the week is thrown off. Check your home code for integer-of-year to make sure it takes this into account.
Dave |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Dave,
excellent response, the technical was right on; i am envious of your diplomatic skills. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Tony01,
Did you ever find a solution to your query?
Dave |
|
Back to top |
|
|
|