locked
how to convert date time RRS feed

  • Question

  • Date Input,

    8/18/2010 3:03:00 PM

    Need below Output,

    08/18/2010 15:03

    Thursday, August 19, 2010 2:50 AM

Answers

  • declare @c varchar(15), @d datetime
    select @d = CONVERT(datetime, '8/18/2010 3:03:00 PM')
    select @d, CONVERT(varchar(16), @d, 101) + SPACE(1) + CONVERT(varchar(5), @d, 108)

    Premature optimization is the root of all evil in programming. (c) by Donald Knuth

    Naomi Nosonovsky, Sr. Programmer-Analyst

    My blog
    • Marked as answer by Yazdani ISTS Thursday, August 19, 2010 4:20 AM
    Thursday, August 19, 2010 2:57 AM

All replies

  • declare @c varchar(15), @d datetime
    select @d = CONVERT(datetime, '8/18/2010 3:03:00 PM')
    select @d, CONVERT(varchar(16), @d, 101) + SPACE(1) + CONVERT(varchar(5), @d, 108)

    Premature optimization is the root of all evil in programming. (c) by Donald Knuth

    Naomi Nosonovsky, Sr. Programmer-Analyst

    My blog
    • Marked as answer by Yazdani ISTS Thursday, August 19, 2010 4:20 AM
    Thursday, August 19, 2010 2:57 AM
  • thnx much Naom
    Thursday, August 19, 2010 4:20 AM