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 |
|
mrm23
Posting Yak Master
198 Posts |
Posted - 2010-12-13 : 07:25:47
|
| Hi All,I need to display time in 12 hour format.I got a solution for this as :select Ltrim(right(convert(char(19),getdate(),100),7))This gives time like 11:05AM , 12:08 PM etc.I want to use these time values for a graph. so, i need only 24 values:12 AM - 11PMi.e : 12 AM , 1AM ,2AM,3AM..........11PM ----> total 24 values.Can anyone help on this? |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-12-13 : 07:33:09
|
| dateadd(hh,datepart(hh,dte),dateadd(dd,datediff(dd,0,dte),0))==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
jcelko
Esteemed SQL Purist
547 Posts |
Posted - 2010-12-14 : 14:18:50
|
| Why are you doing display formating in the database and not the front end? Let the reporting tool do this stuff, like it is supposed to.--CELKO--Books in Celko Series for Morgan-Kaufmann PublishingAnalytics and OLAP in SQLData and Databases: Concepts in Practice Data, Measurements and Standards in SQLSQL for SmartiesSQL Programming Style SQL Puzzles and Answers Thinking in SetsTrees and Hierarchies in SQL |
 |
|
|
|
|
|
|
|