• There are not 59 minutes and 59 seconds in hour #1. There isn't even 59 minutes, 59.9999 seconds. There is 60 seconds in a minute and 60 minutes in an hour. Those are constants.

    If you were counting 2:00:00 as being part of hour #1, there would be 60 minutes and 1 second in hour #1.

    Test it for yourself. Count from 1:00:00 to 2:00:00 incrementing by 1 second.

    Or just run the following:

    Select

    Hour1 = DateDiff(mi, '1/1/2007 1:00 PM', '1/1/2007 2:00 PM'), Hour2 = DateDiff(mi, '1/1/2007 2:00 PM', '1/1/2007 3:00 PM'), Hour1and2Combined = DateDiff(mi, '1/1/2007 1:00 PM', '1/1/2007 3:00 PM')

     

    Or if that doesn't convince you, run the following. You will see that if you included 2:00 as part of hour #1, it would be the 61st minute, not the 60th.

    Declare

    @Start datetime, @End datetime

    Declare @Minutes Table (MinuteNumber int not null identity(1, 1) primary key, MyTime datetime not null)

    Select

    @Start = '1/1/2007 1:00 PM', @End = '1/1/2007 2:00 PM'

    While

    @Start <= @End

        Begin

            Insert Into @Minutes (MyTime)

            Select @Start

            Set @Start = DateAdd(mi, 1, @Start)

        End

    Select

    *

    From @Minutes


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]