Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    16

    Angry Unanswered: How to return date formated like (yyyy/mm/dd)

    Hi everybody

    Exemple of query
    SELECT DT_FIELD FROM TABLE_NAME

    DT_FIELD
    --------------------
    2001-12-20 00:00:00 --This format is not right

    The query must return like that
    DT_FIELD
    --------------------
    2001-12-20 --This is the good format

    I try this function datePart, Convert and cast but is not right

    Thank

  2. #2
    Join Date
    Oct 2003
    Posts
    16

    Re: How to return date formated like (yyyy/mm/dd)

    Originally posted by ericjean
    Hi everybody

    Exemple of query
    SELECT DT_FIELD FROM TABLE_NAME

    DT_FIELD
    --------------------
    2001-12-20 00:00:00 --This format is not right

    The query must return like that
    DT_FIELD
    --------------------
    2001-12-20 --This is the good format

    I try this function datePart, Convert and cast but is not right

    Thank

  3. #3
    Join Date
    Oct 2003
    Posts
    16

    Talking Re: How to return date formated like (yyyy/mm/dd)

    Thank everybody

    I can do like this
    SELECT convert(varchar(10),DT_FIELD,103) FROM TABLENAME

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    FYI for others having the same issue - the convert function has a style parameter which allows for various datetime formats.

Posting Permissions

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