Results 1 to 2 of 2

Thread: Date conversion

  1. #1
    Join Date
    Sep 2003
    Posts
    212

    Unanswered: Date conversion

    I have a datetime field in a table and I have to insert this datatime data into antoher table. In my insert statement I convert the datetime field into varchar and then insert it into the second table.

    The date field in the original table is : 2/2002/13 3:58:12 PM
    but in the destination table i get: 2/2002/13 3:58:00 PM

    I lose the seconds in the conversion, i think

    Whats the best way to preserve to the datetime field during transfer?

    thanks

  2. #2
    Join Date
    Sep 2003
    Posts
    212

    Thumbs up Re: Date conversion

    It works well with:
    convert(char(26),@datetime,9)

    this will preserve the format mon dd yyyy hh:mi:ss:mmmAM (or PM).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •