Tuesday, February 14, 2012

Dateadd problem

Try this:

print dateadd(y,+4, '29 feb 2008')

Funny how the 1 day that is used to go from 29 jan to 1 mar stack if you add multible years to a day.

+4 year should put it back on 29 feb 2012, +3 years should put it on 1 mar 2011.

Well, mabye it has been posted before, I just found it interesting.

That is because you are using y not yy. Look in the BOL for the parameters. dy/y is dayofyear not year.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment