none
Format time in 24 hour format

    Question

  • Hi,

    I am using SQL Server Reporting services 2005 to generate reports. In one of my fields, i am getting the time value as 07:00:00 PM. I want to format the time to be shown in 24 hour format. For example: 19:00:00

     

    How to format the time to be shown in 24 hour format?

     

    Thank you

    Wednesday, September 17, 2008 9:19 AM

Answers

  • Hi,

    In the Format property, i gave this:

    Code Snippet
    HH:mm:ss

     

     

     

    and i got the 24 hour time format.

     

    Thank you

    Wednesday, September 17, 2008 11:16 AM

All replies

  • Hi ,

    The formats supported by SSRS does not include  24 hour format so for that you need to write custom expression.

    you can write the custom expression something like

    =iif(right(2,time) ='PM',left(2,time)+12,"")   // try to put the correct code ,this is just the idea.

     

    Choose the AM and PM format ,then the logic should be if the right 2 charachters are PM then add 12 to the hour part of the time,which should give you 24 hour format. This is just idea ,trythis out .

    Hope you will get the solution.

     

    Let me know if you got the solution.

    Thanks,

    Mahasweta

    Wednesday, September 17, 2008 9:46 AM
    Moderator
  • Hi,

    In the Format property, i gave this:

    Code Snippet
    HH:mm:ss

     

     

     

    and i got the 24 hour time format.

     

    Thank you

    Wednesday, September 17, 2008 11:16 AM
  • Hi,

    In the Format property, i gave this:

    Code Snippet
    HH:mm:ss

     

     

     

     

    and i got the 24 hour time format.

     

    Thank you

    Good one, so simple :)
    Sanjay
    • Proposed as answer by Sanjay Bollina Friday, November 25, 2011 12:41 PM
    Friday, November 25, 2011 12:41 PM
  • For 12 Hour it should be hh:mm:ss

    For 24 it should Hour HH:mm:ss

    You can add tt at end to get the AM/PM for 12 hour

    Cheers

    Alpesh

    Thursday, January 30, 2014 1:29 PM