Convert data

  • Hi

    I want to convert data from

    26/08/2003 once into

    08/26/03

    and once into

    26/08/03 10:00

    This is in a stored procedure.

    There is now a CAST(fld_order_deliverdate AS smalldatetime) but it does not seem to work

    Much obliged !!

    Jeff

    JV


    JV

  • Here is what you want:

    select convert(varchar, convert(datetime, '26/08/2003', 103), 1)

    select convert(varchar, convert(datetime, '26/08/2003', 103), 1) + ' 10:00'

    Bye

    Gabor



    Bye
    Gabor

  • Another suggestion to return what you want. Replace GetDate() with your datetime value.

    select stuff(convert(varchar,getdate(),101),7,2,'')

    select stuff(convert(varchar,getdate(),103),7,2,'') + ' ' + substring(convert(varchar,getdate(),113),13,5)

    Basically have a look at Convert in Books on line, and play about with functions Substring and perhaps Stuff

  • ... Also if you look at the definition of SmallDateTime in Books On Line, you will see it is not what you are after.

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

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