jfrick Posted October 12, 2001 Posted October 12, 2001 Calendar program: I need to create a new record for each day of the next year. If it's a leap year I need 366 days or records added instead of 365. How can I determine whether it's a leap year?
Ocean West Posted October 12, 2001 Posted October 12, 2001 The calendar year is 365 days long, unless the year is exactly divisible by 4, in which case an extra day is added to February to make the year 366 days long. If the year is the last year of a century, eg. 1700, 1800, 1900, 2000, then it is only a leap year if it is exactly divisible by 400. Therefore, 1900 wasn't a leap year but 2000 will be. The reason for these rules is to bring the average length of the calendar year into line with the length of the Earth's orbit around the Sun, so that the seasons always occur during the same months each year. The year is defined as being the interval between two successive passages of the Sun through the vernal equinox. Of course, what is really occurring is that the Earth is going around the Sun but it is easier to understand what is happening by considering the apparent motion of the Sun in the sky. The vernal equinox is the instant when the Sun is above the Earth's equator while going from the south to the north. It is the time which astronomers take as the definition of the beginning of Spring. The year as defined above is called the tropical year and it is the year length that defines the repetition of the seasons. The length of the tropical year is 365.24219 days. In 46 BC Julius Caesar established the Julian calendar which was used in the west until 1582. In the Julian calendar each year contained 12 months and there were an average of 365.25 days in a year. This was achieved by having three years containing 365 days and one year containing 366 days. (In fact the leap years were not correctly inserted until 8 AD). The discrepancy between the actual length of the year, 365.24219 days, and the adopted length, 365.25 days, may not seem important but over hundreds of years the difference becomes obvious. The reason for this is that the seasons, which depend on the date in the tropical year, were getting progressively out of kilter with the calendar date. Pope Gregory XIII, in 1582, instituted the Gregorian calendar, which has been used since then. The change from the Julian calendar to the Gregorian involved the change of the simple rule for leap-years to the more complex one in which century years should only be leap-years if they were divisible by 400. For example, 1700, 1800 and 1900 are not leap-years whereas 2000 will be. The nett effect is to make the adopted average length of the year 365.2425 days. The difference between this and the true length will not have a serious effect for many thousands of years. (The error amounts to about 3 days in 10,000 years.) The adoption of the Gregorian calendar was made in Catholic countries in 1582 with the elimination of 10 days, October the 4th being followed by October 15th. The Gregorian calendar also stipulated that the year should start on January 1. In non-Catholic countries the change was made later; Britain and her colonies made the change in 1752 when September 2nd was followed by September 14 and New Year's Day was changed from March 25 to January 1. Produced by the Astronomy Information Service of the Royal Observatory Greenwich PJA Wed Apr 17 13:18:08 GMT 1996. Last modified - 24 August, 2000 Reference [ October 12, 2001: Message edited by: Ocean West ]
elvis_impersonating_penguin Posted October 15, 2001 Posted October 15, 2001 here is the calc i use for leap year.. Case( IsEmpty(datefield), "", Mod(Year(datefield), 400) = 0, 1, Mod(Year(datefield), 4) = 0 and Mod(Year(datefield), 100) <> 0, 1, 0 ) this will return a 1 if the date in "datefield" is a leap year, and a 0 if it is not. [ October 15, 2001: Message edited by: bman ] [ October 15, 2001: Message edited by: bman ]
jfrick Posted October 15, 2001 Author Posted October 15, 2001 Thank's bman, That's exactly what I'm looking for. -jfrick
LeCates Posted November 1, 2001 Posted November 1, 2001 Hi Jeff, Is there a reason why you want to test for leap year manually? Assuming that you are using a looping script to create all the records in the next year, just loop until (Date(mm,dd,yyyy) > = Date(12,31,yyyy)). Can you let FileMaker handle the leap year itself? Alternatively, you could test whether 3/1/yyyy was the 60th or 61st day of the year. If 61st, then you have a leap year. Good luck!
Recommended Posts
This topic is 8423 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now