Formatting datetime field to 24 hour time

  • How do you format a datetime field in RS to military time?? I've cast the datetime in the proc that's called and it works fine, but can't determine how to do that in Reporting Services in the layout or field format. Nothing seems to work. Thanks in advance, Mike

  • G'day Mike,

     

    Don't know if it helps, but I had heaps of problems with dates and in the end wrote a function that formats the date and returns a string for display purposes.

    i.e.

    Return CDate(dateReturn).AddDays(Diff).ToString("dd MMM yyyy HH:nn")

    the Value property of the Text box is "=Code.FormatDate(Fields!Somedate.Value)"

     

    HTH

  • Set Format property to HH:mm. make sure that the datatype of this value is datetime. Hope it helps.

  • Here are some options:

    SELECT CONVERT(varchar, getdate(), 113)

    SELECT CONVERT(varchar, getdate(), 114)

    SELECT CONVERT(varchar, getdate(), 120)

    SELECT CONVERT(varchar, getdate(), 121)

    ------------------------------

    01 Sep 2006 15:23:23:927

    (1 row(s) affected)

                                  

    ------------------------------

    15:23:23:927

    (1 row(s) affected)

                                  

    ------------------------------

    2006-09-01 15:23:23

    (1 row(s) affected)

                                  

    ------------------------------

    2006-09-01 15:23:23.943

    (1 row(s) affected)

  • Well I ended up just splitting the datetime field into two (date and time) and then formatting...that worked fine. Thanks to all!

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

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