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 |
|
w_cohen
Starting Member
6 Posts |
Posted - 2008-05-16 : 13:23:00
|
| How can I obtain just the time portion from a date/time column?My data contains "2008-05-19 09:30:00.000"Actually, all I want/need is the hh:mm part of it.Thanks,Walt |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-16 : 13:26:07
|
| DECLARE @dt datetimeSET @dt = '2008-05-19 09:30:00.000'SELECT LEFT(CONVERT(varchar(50), @dt, 108), 5)Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-16 : 13:27:16
|
| Use LEFT(CONVERT(varchar(20),yourdatecolumn,108),5) |
 |
|
|
|
|
|