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 |
|
mark1504
Posting Yak Master
103 Posts |
Posted - 2005-04-12 : 09:11:28
|
| Is this the best method of selecting the time from a date field?(The lower case is my display preference.)SELECT LOWER(SUBSTRING(Convert(varchar(19),GETDATE(),100),13,7))ThanksMark |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-04-12 : 09:17:41
|
| Try thisSELECT Convert(varchar(20),GETDATE(),108)MadhivananFailing to plan is Planning to fail |
 |
|
|
mark1504
Posting Yak Master
103 Posts |
Posted - 2005-04-12 : 09:20:30
|
| Sorry, the output from my example is the one I require: i.e. 2:20pm |
 |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-04-12 : 09:26:22
|
Or you could useSELECT LOWER(RIGHT(Convert(varchar(19),GETDATE(),100),7))AndyBeauty is in the eyes of the beerholder |
 |
|
|
mark1504
Posting Yak Master
103 Posts |
Posted - 2005-04-12 : 09:46:17
|
| Thanks Andy. Doesn't look like there's much to choose from these, although yours is a few characters shorter, and that always wins points in my book.Should I assume that this is about as good as it'll get?RegardsMark |
 |
|
|
|
|
|