Results 1 to 5 of 5

Thread: Date format

  1. #1
    Join Date
    Apr 2004
    Posts
    101

    Unanswered: Date format

    Hi,
    i am storing dates as datetime, so let us say the date is 2004-07-15 11:42:43.780. Now i want to retrieve it exactly like this. Unfortunately it doesnot come out like this.
    It is coming out like this Jul 15 2004 11:44AM and i'm losing the seconds
    and milliseconds.
    Could anyone please advise me how to get 2004-07-15 11:42:43.780.
    Thanks in advance.
    -ss

  2. #2
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    Select Convert (varchar, Getdate(), 121)

  3. #3
    Join Date
    Apr 2004
    Posts
    101
    Thanks you very much

  4. #4
    Join Date
    May 2004
    Location
    India \n now Dubai
    Posts
    6

    Problem with DATE

    Hi experts

    Can any one help me !!!

    I had also having the same type or problem !

    select msgdate from emc_messageinfo

    Sql server 2000 returns the following
    2004-07-01 15:04:10.000

    and i need only the current date means "01-07-2004" ,but not in varchar format i need in date format only so that i can use it further


    Thanks and regards

    Manish Kaushik

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    MS-SQL doesn't distinguish between date and time, there is a single datatype that is DATETIME (and a sub-set of it that is SMALLDATETIME). You can truncate the value to either a date or a time to make computation easier, but you can't truly isolate the date from the time. Try using:
    Code:
    SELECT Convert(CHAR(10), Getdate(), 121)
    -PatP

Posting Permissions

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