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 |
|
wireless
Starting Member
8 Posts |
Posted - 2003-05-08 : 13:58:32
|
| Is it possible to return a Date format with something of the form mm/dd/yy hh:mm?I'm using Convert() but there doesn't appear to be a format for this. The closest is using CONVERT(char(10), [Date], 0) which returns "May 7 2003 5:00PM". If I just output in datetime format, it comes out as 5/7/2003 5:00:00 PMBut if I try to LEFT(Date, 16) it converts is back to May 7 2003 5:00PM-David |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-05-08 : 14:29:53
|
SELECT CONVERT(varchar(10),GetDate(),101) + ' ' + SUBSTRING(CONVERT(varchar(10),GetDate(),14),1,5) Brett8-) |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-05-08 : 16:13:31
|
| I recommend fine tuning output in the client that is displaying this data -- don't try to use T-SQL to format your output.For example, how is this data being displayed to the end user? a web page, a report, vb app, etc? Do most of the formatting in those applications if you can.- Jeff |
 |
|
|
wireless
Starting Member
8 Posts |
Posted - 2003-05-12 : 09:10:51
|
| OKay thanks. I will be displaying it in an asp datagrid. I'll format it there. Normally, I try to do as much as possible with sql because it's power is such that a simple sql statement often saves many lines of code. -David |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-05-12 : 09:27:55
|
| Very true, wireless, but it works both ways. Sometimes it requires many lines of SQL code (or a long complex expression) to do things that can be done easily in a client !Running totals is the perfect example ... trivial at the client end, surprisingly hard for SQL.- Jeff |
 |
|
|
|
|
|
|
|