29 Feb incorrect in DateAdd and GetDate command

50 pts.
Tags:
Microsoft SQL Server 2000
SQL Server development
Hi, Does anyone know Why the day of date different ? when i used : select GetDate() --> It's Return 2008-02-29 11:01:45.310 and then when used : select DateAdd(yyyy,543,GetDate() ) ---> It's return 2551-02-28 11:01:45.310 My SQL Server is MS SQL Standard Edittion VERSION 6.5 Anyone have any ideas ?

Answer Wiki

Thanks. We'll let you know when a new response is added.

That would be because in 543 years there is no leap year. Leap year is in 544 years.

I ran this to find the leap years. (I’m on the west coast so it’s still the 28th.
<pre>select GETDATE()+1
select DateAdd(yyyy,541,GetDate()+1 )
select DateAdd(yyyy,542,GetDate()+1 )
select DateAdd(yyyy,543,GetDate()+1 )
select DateAdd(yyyy,544,GetDate()+1 )
select DateAdd(yyyy,545,GetDate()+1 )
select DateAdd(yyyy,546,GetDate()+1 )
select DateAdd(yyyy,547,GetDate()+1 )</pre>

If you look in Wikipedia you’ll find this information about leap year.
<pre>A person born on February 29 may be called a “leapling”. In common years they usually celebrate their birthdays on 28 February or 1 March.

For legal purposes, their legal birthdays depend on how different laws count time intervals. In Taiwan, for example, the legal birthday of a leapling is 28 February in common years, so a Taiwanese leapling born on February 29, 1980 would have legally reached 18 years old on February 28, 1998.</pre>

I bet if you check into American law you’ll find that we have the same law here in the US.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following