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 |
![]() |
have you tried Convert(varchar(10), @fDate, 103) ?
check out complete list of style codes in sql server books online.
![]() |
0 |
![]() |
your a star!!
Thanks so much.
![]() |
0 |
![]() |
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 |
![]() |