quick date conversion - not hard!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andreas2410
    New Member
    • Jan 2007
    • 6

    quick date conversion - not hard!

    im trying to convert my column of data type datetime. this is an example of what the data looks like:

    2007-01-24 10:01:29.710

    i want to format it as so

    200701241001

    ive tried this so far i think im sort of on the right track

    RIGHT('00000000 0000' + CONVERT(varchar (20), CONVERT(int, sr.ResponseDate )),12) AS FinalDate

    but its not outputting exactly what i want

    thanks
    andreas
  • andreas2410
    New Member
    • Jan 2007
    • 6

    #2
    Originally posted by andreas2410
    im trying to convert my column of data type datetime. this is an example of what the data looks like:

    2007-01-24 10:01:29.710

    i want to format it as so

    200701241001

    ive tried this so far i think im sort of on the right track

    RIGHT('00000000 0000' + CONVERT(varchar (20), CONVERT(int, sr.ResponseDate )),12) AS FinalDate

    but its not outputting exactly what i want

    thanks
    andreas

    im also thinking that i will need when i try convert

    to put it into the style code either

    code 20 or 120 yyyy-mm-dd hh:mi:ss(24h)

    so thats 24 hour which is what i need and then rip the separators

    or in code 126 below so theres no spaces, but i dont think thats 24 hr representation

    code 126 yyyy-mm-dd Thh:mm:ss.mmm(n o spaces)

    Comment

    Working...