Results 1 to 5 of 5

Thread: sql server query

  1. #1
    Join Date
    Mar 2003
    Posts
    16

    sql server query

    I Have a date Field say dt1 in table tb1

    i need to write a query to retrieve date formatted in dd/mm/yyyy format

    the following query

    select convert(datetime,dt1,103) from tb1

    returns time with date

    what query to use

  2. #2
    Join Date
    Sep 2002
    Location
    Amsterdam
    Posts
    53
    Use this:
    select convert(varchar(10),dt1,103) ) from tb1

  3. #3
    Join Date
    Mar 2003
    Posts
    16
    thanks it works but 103 style stands for dd/mm/yy not dd/mm/yyyy

  4. #4
    Join Date
    Feb 2003
    Posts
    102

    203

    Use 203.

    "Add 100 to a style value to get a four-place year that includes the century (yyyy)."

    It all in Books Online.

    HTH,

    Peter

  5. #5
    Join Date
    Mar 2003
    Posts
    16
    thanks!!! i shall try

Posting Permissions

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