getdate() frustration

  • Hi,

    I was wondering if someone could help me out.  I would to get date in the following format:

    mm/dd/yyyy hh:mi:ss

    I have googled and checked the google site to no avail... the bol is a bit confusing.  Could someone help me out with this request?

     

    Thank you.

    -----------------------------
    www.cbtr.net
    .: SQL Backup Admin Tool[/url] :.

  • Check BOL again under the CONVERT function. There are no direct convert formats that give you this exact format, so you need to concatenate format 101 (mm/dd/yyyy) and format 108 (hh:mm:ss):

    select convert(varchar, getdate(), 101) + ' ' + convert(varchar, getdate(), 108)

     

  • PW, once again, thank you.

    I was looking at the other functions (datediff, datepart, etc ...) and didn't look at convert.

    -----------------------------
    www.cbtr.net
    .: SQL Backup Admin Tool[/url] :.

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

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