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 |
teedah1
Starting Member
10 Posts |
Posted - 2007-05-03 : 15:40:29
|
Hi all, I am trying to truncate the time portion in datetime in .ASP.Column is showing a sql datetime field of mm/dd/yyyy 12:00:00 AM. how do I remove this time piece and just leave the date? Do I do it in SQL or ASP? Thanks for your advice. |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-03 : 15:42:36
|
dates in the database are always stored with date and time.so are you trying ti "fix" your data in a table or you're having presentation issues where you want to format the date string?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
teedah1
Starting Member
10 Posts |
Posted - 2007-05-03 : 15:47:01
|
Hi spirit, yes, i am trying to truncate that default 12:00:00 AM when it is displayed on the asp Gridview column. |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-03 : 15:51:05
|
use yourDateTimeVariable.ToShortDateString()oryourDateTimeVariable.ToString("yyyy-MM-dd"); or use any other format you wish in the ToString() ,ethod_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-03 : 15:51:48
|
 _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
|
|