DateTime formatting, Web App, Web Service, SQL Server

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.
 
D

Dan Bass

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.
 
I

Ignacio Machin \( .NET/ C# MVP \)

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top