Hours in HH:MM format

  • Currently I have a column Column1 in SQL Table1 that has datatype datetime, where the data is displayed as 1899/12/30 4:59:00 PM.

    I have a query:

    CONVERT(varchar(8), dbo.Table1.Column1,8) AS HoursUpdation

    This gives me just the Hours as 4:59:00

    But I do not want to see the seconds also.

    I just want it in the format HH:MM

    Can anyone please let me know the way to achieve this?

    Thank you,

    notes4we

  • try this

    select LEFT(CONVERT(VARCHAR(8), GetDate(), 8), 5)

  • Thank you. I found syntax little more simpler:

    CONVERT(varchar(5), dbo.Table1.Column1,8) AS HoursUpdation

    Thank you once again for your response too.

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

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