getting date in day/month/year instead of month/day/year

I am trying to get my db to return a date in the format day/month/year but its returning the american version month/day/year.

I'm using a DatePart function that converts my date:

CREATE FUNCTION dbo.DatePart
( @fDate datetime )
RETURNS varchar(10)
AS
BEGIN
RETURN ( CONVERT(varchar(10),@fDate,101) )
END

This returns te american version, can anyone help me to get this to convert the UK way.
Thanks
0
g_r_a_robinson
2/2/2004 11:30:12 PM
📁 asp.net.sql-datasource
📃 29906 articles.
⭐ 0 followers.

💬 3 Replies
👁️‍🗨️ 955 Views

have you tried  Convert(varchar(10), @fDate, 103) ?

check out complete list of style codes in sql server books online.
0
dhjiang
2/3/2004 3:27:06 PM
your a star!!

Thanks so much.
0
g_r_a_robinson
2/3/2004 9:56:02 PM

 

hi, I have special probelm ,I have a textbox on a form

which a I input a date into textbox how dd-mm-yy,  if become dd<09 there is'nt any problem

and Submit button does work as well and I can send my date to Database.

but when I insert  day bigger than 09  (dd >09 ) for example "10-09-2007", my text box will be change to 09-10-2007

but the other place in my project works as well.

Thanks

I remain you

this is my currently code that I use:

<asp:TextBox ID="TextBoxDocumentDate"
runat="server" CssClass="formbox" MaxLength="10" Columns="10" ValidationGroup="Data"

Text='<%# DataBinder.Eval(Container.DataItem, "DocumentDate") == System.DBNull.Value || DataBinder.Eval(Container.DataItem, "DocumentDate") == null ? "" : Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "DocumentDate")).ToString("dd-MM-yyyy") %>'

 

 

0
hmokhtari
9/6/2007 12:00:51 PM
Reply: