Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
vk18
Posting Yak Master
146 Posts |
Posted - 2006-12-11 : 18:11:24
|
Hello Friends,I am using VB.NET/ASP.NET and SQL SERVER2000. The datatype for the time iam using is datetime. when i display the time in one of the text box i am getting the time like 1/1/1900 02:20:12PM. I just want the time. how can i format this. Any Ideas..?Thx |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-11 : 18:12:22
|
Yes, use FormatDateTime function when displaying the date in the textbox in ASP, and Format function with VB.Peter LarssonHelsingborg, Sweden |
 |
|
vk18
Posting Yak Master
146 Posts |
Posted - 2006-12-11 : 22:46:37
|
quote: Originally posted by Peso Yes, use FormatDateTime function when displaying the date in the textbox in ASP, and Format function with VB.Peter LarssonHelsingborg, Sweden
Hi,Can you show me one Example..? by the way i am using VB.NET/ASP.NETThx |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-12 : 01:08:14
|
Response.Write FormatDateTime(rs.Fields("MyDateTimeColumnNameHere"), 1)Peter LarssonHelsingborg, Sweden |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-12-12 : 08:33:26
|
You need to show us an example of how you are producing your output (datagrid? labels? response.write? etc) and we can help you. It all depends on the context of how you are outputting data. Some controls have a Format property, other times you can use the overloaded ToString() method of a class to do it, other times you might want to use the static Format method of the String class (nice because you build strings with lots of arguments all formatted the way you want without concatenation). There's many ways to do it, depending on the context.I would also suggest a very simple google search for the terms "asp.net datetime format" that will turn up millions of examples as well.- Jeff |
 |
|
vk18
Posting Yak Master
146 Posts |
Posted - 2006-12-12 : 11:28:12
|
quote: Originally posted by jsmith8858 You need to show us an example of how you are producing your output (datagrid? labels? response.write? etc) and we can help you. It all depends on the context of how you are outputting data. Some controls have a Format property, other times you can use the overloaded ToString() method of a class to do it, other times you might want to use the static Format method of the String class (nice because you build strings with lots of arguments all formatted the way you want without concatenation). There's many ways to do it, depending on the context.I would also suggest a very simple google search for the terms "asp.net datetime format" that will turn up millions of examples as well.- Jeff
Hi,I am populating the GUI in this way. here is the code Me.txtatime.Value = objspotclass.GS_timeactualI just want to display the time in the text box not with the dateThx |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-12-12 : 12:11:18
|
What datatype is GS_timeactual?If it is datetime, then there are lots of methods available for formatting: ToString, ToLongTimeString, ToShortTimeString, and so on. Just type the "dot" after GS_timeactual and you'll get all sorts of options. I hestitate to give you code because I don't want you to just cut and paste, see that it works, and move on without doing some research to find the best way and to understand why it works.see: http://msdn2.microsoft.com/en-us/library/system.datetime_methods(vs.71).aspxI really recommend reading a good beginning book on asp.net or vb.net if these concepts aren't familiar to you; they are pretty fundamental and important to know before doing too much programming in asp.net.- Jeff |
 |
|
|
|
|
|
|