time format

  • Can I display a datetime column as hh:mm ? All the styles I see under convert are hh:mm:ss

  • well - there's 0 or 100 that gives you hh:mm in AM/PM - would that work ?!







    **ASCII stupid question, get a stupid ANSI !!!**

  • I don't want to see the date, only the time.

  • Try this:

    select Convert(Char(5),getdate(),108)

  • Why can't you let the application display the data correctly to the users??

     

    The server is there (mainly) as a datastore, not a report viewer!

  • True... but sometimes there is no application.  Besides, formatting a date is a simple form of data manipulation... why not do "data manipulation" in a database? 

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Ya I know. But it's always good to see both sides of the coin on this one ... before it goes too far!

  • Both sides of the coin?  I normally end up looking at the edge of the coin, too

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Then start looking at both edges .

  • My reasoning on this was that doing some simple concantenation and dressing up the data a bit at the DB level could save network traffic (one field going across rather than 4 or 5) and increase speed.

    Not true?

    Sam

  • Well it's like asking us if 3<5 = true !

    Depends how much less data is transfered vs how long it takes to create the string but it's usually a win situation .

  • Concur... my point exactly...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 12 posts - 1 through 11 (of 11 total)

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