| Author |
Topic |
|
Aramis
Starting Member
13 Posts |
Posted - 2009-09-22 : 21:08:21
|
| Guys,I'm a newbie in SQL, I have a data that i set in datetime in SQL, how could i rid off the time and i want it the date show in my vb.net? thanks for the help |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-09-22 : 21:43:27
|
| There's a format function of some kind in VB.Net (it was...wait for it...Format() in VB, not sure about VB.Net). If that won't float your boat:SELECT CONVERT(char(10), dateValue, 101) dateVal FROM myTableLook up the CONVERT() function in SQL Server Books Online for more information on different date formats. |
 |
|
|
Aramis
Starting Member
13 Posts |
Posted - 2009-09-22 : 21:48:30
|
| thanks a lot, let me try this one... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-23 : 02:47:15
|
| In VB.NET it is something likedate_var.tostring("MM/dd/yyyy")MadhivananFailing to plan is Planning to fail |
 |
|
|
Aramis
Starting Member
13 Posts |
Posted - 2009-09-24 : 04:36:12
|
| thanks madhivanan |
 |
|
|
winterh
Posting Yak Master
127 Posts |
Posted - 2009-09-24 : 10:24:13
|
| Select convert(DateTime, Convert(VarChar(10), dateValue, 112))[ /fail at humor] |
 |
|
|
winterh
Posting Yak Master
127 Posts |
Posted - 2009-09-24 : 10:26:23
|
| Fail...[ /fail at humor] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-24 : 10:27:30
|
quote: Originally posted by winterh Select convert(DateTime, Convert(VarChar(10), dateValue, 112))[ /fail at humor]
I dont think OP needed thisAnyway alternate method isselect dateadd(day,datediff(day,0,dateValue),0)MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-24 : 10:30:02
|
quote: Originally posted by winterh Then MID(1, 9, dateValue)[ /fail at humor]
MID wont work in SQL ServerAlternate is SUBSTRING[/fail at query] MadhivananFailing to plan is Planning to fail |
 |
|
|
winterh
Posting Yak Master
127 Posts |
Posted - 2009-09-24 : 10:32:44
|
| Dang, I got owned again! Sorry, it's best if the newbs ignore my replies lol. Dang.[ /fail at query] |
 |
|
|
|