@tomazsr,
Although, pastorchris's explanation of the datediff function and how it works is accurate, I see you are already using this in your code; therefore, you must be having difficulties with something else with the code, so will take a closer look.
I see now that the number of days is off. This can be caused some times by leaps years and other such differences in number of days in a month.
Will let you know.
Kevin
Main Topics
Browse All Topics





by: pastorchrisPosted on 2009-09-04 at 05:52:54ID: 25259006
use a function called DATEDIFF
Usage is DATEDIFF ( datepart , startdate , enddate )
Select DATEDIFF ( dd, gatdate()-1, getdate()) returns 1, meaning 1 day's difference.
The datepart for year is yy. Please use this.
For you to get the different date parts, use boosk online.