A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Determine if Leap Year



 
 
Thread Tools Display Modes
  #11  
Old July 23rd, 2009, 10:27 PM posted to microsoft.public.access.forms
cp2599
external usenet poster
 
Posts: 46
Default 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  
Old July 23rd, 2009, 10:28 PM posted to microsoft.public.access.forms
cp2599
external usenet poster
 
Posts: 46
Default 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  
Old July 24th, 2009, 03:28 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.