Question

  Asked: Feb 29 2008   4:53 AM GMT
  Asked by: 2830360


29 Feb incorrect in DateAdd and GetDate command


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 ?

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



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.
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 )


If you look in Wikipedia you'll find this information about leap year.
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.


I bet if you check into American law you'll find that we have the same law here in the US.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on SQL Server.

Looking for relevant SQL Server Whitepapers? Visit the SearchSQLServer.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Mrdenny  |   Feb 29 2008  7:48AM GMT

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.