473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Datetime, SQL Server, Web App, Web Service

Hi,

I have a column of type datetime in a SQL Server database. I set and
get this column with Web Services using dataset and send them to a Web
App TextBox control. The collation of the database is
SQL_Latin1_General_CP1_CI_AS (if it necessary I could change it).
I didn't change options in Web service and Web app (web_config).
The date is shown in this format: "mm/dd/yyyy hh:mm:ss AM/PM". I would
like the format to be "dd/mm/yyyy hh:mm:ss" (hh 00-23).

What could I do to fix this problem?

Thanks.

Nov 17 '05 #1
3 2456
Use DateTime.Parse to get it into a DateTime instance, then set the
TextBox's Text property using the DateTime's ToString method, along with the
format you want.

DateTime myDateTime =
DateTime.Parse(ds.Tables[0].Rows[0]["columnName"].ToString());
myTextBox.Text = myDateTime.ToString("dd/mm/yyyy hh:mm:ss");

You get the idea?
HTH,
Dan Cox

"Iwan Petrow" <xx****@abv.bg> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi,

I have a column of type datetime in a SQL Server database. I set and
get this column with Web Services using dataset and send them to a Web
App TextBox control. The collation of the database is
SQL_Latin1_General_CP1_CI_AS (if it necessary I could change it).
I didn't change options in Web service and Web app (web_config).
The date is shown in this format: "mm/dd/yyyy hh:mm:ss AM/PM". I would
like the format to be "dd/mm/yyyy hh:mm:ss" (hh 00-23).

What could I do to fix this problem?

Thanks.

Nov 17 '05 #2
CSharper wrote:
Use DateTime.Parse to get it into a DateTime instance, then set the
TextBox's Text property using the DateTime's ToString method, along
with the format you want.

DateTime myDateTime =
DateTime.Parse(ds.Tables[0].Rows[0]["columnName"].ToString());
myTextBox.Text = myDateTime.ToString("dd/mm/yyyy hh:mm:ss");
I think it should be "dd/MM/yyyy HH:mm:ss": MM (capitals) is month number,
"mm" (lowercase) is minutes. "HH" is hours in 24-format.

You get the idea?
HTH,
Dan Cox

"Iwan Petrow" <xx****@abv.bg> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi,

I have a column of type datetime in a SQL Server database. I set and
get this column with Web Services using dataset and send them to a
Web App TextBox control. The collation of the database is
SQL_Latin1_General_CP1_CI_AS (if it necessary I could change it).
I didn't change options in Web service and Web app (web_config).
The date is shown in this format: "mm/dd/yyyy hh:mm:ss AM/PM". I
would like the format to be "dd/mm/yyyy hh:mm:ss" (hh 00-23).

What could I do to fix this problem?

Thanks.

Nov 17 '05 #3
I think he can figure out his own format string, that's probably the least
of his worries.

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
CSharper wrote:
Use DateTime.Parse to get it into a DateTime instance, then set the
TextBox's Text property using the DateTime's ToString method, along
with the format you want.

DateTime myDateTime =
DateTime.Parse(ds.Tables[0].Rows[0]["columnName"].ToString());
myTextBox.Text = myDateTime.ToString("dd/mm/yyyy hh:mm:ss");


I think it should be "dd/MM/yyyy HH:mm:ss": MM (capitals) is month number,
"mm" (lowercase) is minutes. "HH" is hours in 24-format.

You get the idea?
HTH,
Dan Cox

"Iwan Petrow" <xx****@abv.bg> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi,

I have a column of type datetime in a SQL Server database. I set and
get this column with Web Services using dataset and send them to a
Web App TextBox control. The collation of the database is
SQL_Latin1_General_CP1_CI_AS (if it necessary I could change it).
I didn't change options in Web service and Web app (web_config).
The date is shown in this format: "mm/dd/yyyy hh:mm:ss AM/PM". I
would like the format to be "dd/mm/yyyy hh:mm:ss" (hh 00-23).

What could I do to fix this problem?

Thanks.


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Symon R | last post by:
This is a bit of a weird one that I haven't yet been able to solve - I'm hoping someone out there can disprove my findings and tell me where I've gone wrong! I have designed a web service that...
2
by: BjörnHolmberg | last post by:
Hi everyone! In the following code we get a UTC offset in xml. Since I want my WAP users in UTC+02:00 to see data on a server in some US time zone, a lot of confusion will be created from this...
2
by: Iwan Petrow | last post by:
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...
5
by: Iwan Petrow | last post by:
Hi, I have Win application -> Web service -> Sql Server. The user input date and time in format dd/MM/yy hh:mm. I convert it to datetime and send it to a web service which save it to the db. But...
2
by: Tronex | last post by:
Hi there, I am desperate and need help on this from someone who actually knows what he does... cuz I certainly don't ;-) This is the situation: I have an ASP.NET web application (written in...
1
by: M DL via .NET 247 | last post by:
Hi all, i have one problem with a method of an xml web service that use a datetime data type input variable, and may be all is caused by international settings. The XML web service (localized...
4
by: Lucvdv | last post by:
I have to connect to a server set up by the government, where they used Apache Axis to create a webservice. The code I use to interface to the webservice is generated by wsdl.exe, based on a...
3
by: Larry Bertolini | last post by:
For some reason, I recall having read that SQL Server 2005 would support a datatype that represented date, but not time. (This would be useful for storing things like birthday, where you usually...
2
by: PurpleServerMonkey | last post by:
Hopefully a simple DateTime problem. I've got a windows service created in C# on .Net Framework 2.0, the service uses a system timer to fire an event every second and compare that against a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.