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)
 Convert EST 24 hour format to EST 12 hours format

Author  Topic 

itnagaraj
Yak Posting Veteran

70 Posts

Posted - 2012-09-10 : 03:06:06
Thae date time is '2012-09-07 23:48:41.000'

How to convert EST 12 hour format in sql server?

V.NAGARAJAN

Andy Hyslop
Starting Member

14 Posts

Posted - 2012-09-10 : 05:10:14
Hi


SELECT SUBSTRING(CONVERT(varchar, getdate(), 100), 13, 2) + ':'
+ SUBSTRING(CONVERT(varchar, getdate(), 100), 16, 2) + ' '
+ SUBSTRING(CONVERT(varchar, getdate(), 100), 18, 2) AS Time


Andy
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-09-13 : 05:13:42
Don't you just need this?

select right(convert(varchar(30),getdate(),100),7)

Also this is presentation issue that should be handled by your front end application

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -