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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 display time

Author  Topic 

TMDOSS
Starting Member

33 Posts

Posted - 2008-12-16 : 15:37:49
I need to get only the time from the database.So I used
select CONVERT(CHAR(8),getdate(),8) just to get the time.but it always returing times like 13:00 ,14.00 ect. is there any any I can get 1.00 PM ,2.00 PM ect...
Any help greatly appreciated.

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-12-16 : 15:53:35
[code]
select right(convert(varchar(25),getdate(),0),6)
[/code]
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-16 : 16:18:20
This is a presentation layer issue and should be handled by your application.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2008-12-16 : 23:16:11
Try this also , Put 100 in place of 0
select right(convert(varchar(25),getdate(),100),7)


I Struggle For Excellence
Go to Top of Page

TMDOSS
Starting Member

33 Posts

Posted - 2008-12-17 : 09:08:35
thank you. You guy's Rock
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2008-12-17 : 23:21:46
Welcome


I Struggle For Excellence
Go to Top of Page
   

- Advertisement -