DateTime formatting, Web App, Web Service, SQL Server

  • Thread starter Thread starter Iwan Petrow
  • Start date Start date
I

Iwan Petrow

Hi,

I have a column DateTime in a table in MS SQL Server database. I take
this column using a Web Service and show it in a TextBox in a Web
Application. I want the format of the date to be
"dd\mm\yyyy hh:mm:ss". The collation name of the database is
SQL_Latin1_General_CP1_CI_AS (if it necessary I could change it).
In the Web service and in the Web App I don't change anything about
culture and the text box shows "mm/dd/yyyy hh:mm:ss AM/PM" .

I use a DataSet to get the data from the database (fill it with
SqlDataAdapter).

What could I do to fix this problem?

Thanks.
 
I always use dd MMM yyyy as the date when passing it around servers, then
when it comes to display it, change it how you like.

Culture settings cause no end of problems (even when it seems like the
culture settings are correct for what you want) when using dd/mm/yyyy which
is ambigious with mm/dd/yyyy when it comes to things like 10/03/2005.
 
Hi,

Use it as a DateTime all the time, in this way you will not care about the
different representations, at the web server, when you need to convert it
to string use DateTime.ToString( string format) to format it as needed,


Cheers,
 
Back
Top