Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006
    Posts
    36

    Question Unanswered: Store date as "dd-mmm-yyyy"

    Hi
    I'm trying to store dates in this format as I have generated a control in asp.net which stores dates in this format as per the clients request. I am using the datetime type in my tables. How do exclude the time part of the value and get it to save in the above format. Using sql 2005. Localisation is currently set to 'en-gb'. Thanks.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    The datetime datatype does not store dates in a specific format. The value is stored as a numeric representation. How it is displayed is up to the application interface.

    To exclude the time portion from a datetime value, you can use this function:

    select dateadd(day, datediff(day, 0, [YourDateValue]), 0)
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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