Find difference in time which is AM PM format

  • Hi,

    I want to find difference between two times which is in AM PM format. Please suggest any idea how to do that?

    Thanks

    Abhas

  • Convert them to datetime values and use the DATEDIFF function to find the difference.

  • Hi Michael,

    I tried but value will display same for both AM and PM,

    example 07:30 AM and 07:30 PM will display same value as below.

    07:30:00.0000000

    Thanks,

  • Convert them to datetime with the correct format code and use the DATEDIFF function. Don't store dates as varchars, you end up with all sorts of problems if you do so.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply