If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Determine if Leap Year
On Jul 23, 4:45*pm, fredg wrote:
On Thu, 23 Jul 2009 13:23:43 -0700 (PDT), cp2599 wrote: On Jul 23, 4:05*pm, KARL DEWEY wrote: * *IIF(Year(Date()) Mod 4 0, "Leap Year", "Not Leap Year") -- Build a little, test a little. "cp2599" wrote: I need to know how to tell if an entered year is a leap year so that I know whether to concatenate an 02/28/ or an 02/29/ to the end of the month date. *Any ideas? I know leap years have to be evenly divisible by 4 but don't know how to check the remainder. *I also think there's another piece to the equation to prevent years like 2000 from being included, but can't remember the formula.- Hide quoted text - - Show quoted text - Thank you ... do you know the second half of the leap year edit? "do you know the second half of the leap year edit" What do you mean by that part? Perhaps this ... If Year is divisible by 4 or if a Century Year is divisible by 400 (without a remainder) it is a leap year. 1996/4 = 499 (Leap Year 1998/4 = 499.5 (Not a leap year) Or Century years 1900/400 = 4.75 (Not a leap year) 2000/400 = 5 (Leap Year) 2100/400=5.25 (Not a leap year) -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail- Hide quoted text - - Show quoted text - Thank you |
#12
|
|||
|
|||
Determine if Leap Year
On Jul 23, 4:13*pm, "Douglas J. Steele"
wrote: Not quite. For example, 1900 wasn't a leap year, nor will 2100 be one, yet they're both divisible by 4. IIf(Day(DateSerial(Year(Date()), 3, 0)) = 29, "Leap Year", "Not Leap Year") -- Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele (no e-mails, please!) "KARL DEWEY" wrote in message ... * IIF(Year(Date()) Mod 4 0, "Leap Year", "Not Leap Year") -- Build a little, test a little. "cp2599" wrote: I need to know how to tell if an entered year is a leap year so that I know whether to concatenate an 02/28/ or an 02/29/ to the end of the month date. *Any ideas? I know leap years have to be evenly divisible by 4 but don't know how to check the remainder. *I also think there's another piece to the equation to prevent years like 2000 from being included, but can't remember the formula.- Hide quoted text - - Show quoted text - Just used the DateSerial function to get the end date I'm looking for. Thanks. |
#13
|
|||
|
|||
Determine if Leap Year
On Thu, 23 Jul 2009 13:05:01 -0700, KARL DEWEY
wrote: IIF(Year(Date()) Mod 4 0, "Leap Year", "Not Leap Year") Try it for 1900. That wasn't a leap year. 2100 won't be either! OK, I know this won't come up in most apps... just being a smartass. -- John W. Vinson [MVP] |
|
Thread Tools | |
Display Modes | |
|
|