Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2003
    Location
    Ohio
    Posts
    20

    Unanswered: Date in Europe format.

    In my table in SQL Server my date column is the data type of datetime. One of the row is 2003-06-17 00:00:00.000. I have to display in my reports the date as 17/06/2003. What will be the syntax I will need to use?
    Select (datepart(day,ReturnByDt) + '/ ' + datepart(month,ReturnByDt)+ '/'+ datepart(year,ReturnByDt)) from tblA

    I get an error message:
    Syntax error converting the varchar value '/ ' to a column of data type int.

    Any ideas??
    Thanks
    Sri

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Dates are stored in the database as numbers...you need to pick your format.

    Look up convert

    oh, and here

    SELECT CONVERT(varchar(10),Getdate(),103)
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    149

    Re: Date in Europe format.

    Select cast(datepart(day,@ReturnByDt) as varchar(5)) + '/' + cast(datepart(month,@ReturnByDt) as varchar(5))+ '/'+ cast(datepart(year,@ReturnByDt) as varchar(5))


    Originally posted by sri2003
    In my table in SQL Server my date column is the data type of datetime. One of the row is 2003-06-17 00:00:00.000. I have to display in my reports the date as 17/06/2003. What will be the syntax I will need to use?
    Select (datepart(day,ReturnByDt) + '/ ' + datepart(month,ReturnByDt)+ '/'+ datepart(year,ReturnByDt)) from tblA

    I get an error message:
    Syntax error converting the varchar value '/ ' to a column of data type int.

    Any ideas??
    Thanks
    Sri

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    149

    Re: Date in Europe format.

    Brett's idea is better. Ignore mine.

  5. #5
    Join Date
    Oct 2003
    Location
    Ohio
    Posts
    20

    Smile Thanks!!

    Brett..Thanks a million for your quick reply.

    Originally posted by Brett Kaiser
    Dates are stored in the database as numbers...you need to pick your format.

    Look up convert

    oh, and here

    SELECT CONVERT(varchar(10),Getdate(),103)

  6. #6
    Join Date
    Oct 2003
    Location
    Ohio
    Posts
    20

    Re: Thanks!!

    Sorry was not clear.....Your syntax worked perfect for me.
    Originally posted by sri2003
    Brett..Thanks a million for your quick reply.

Posting Permissions

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