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)
 Format DateTime

Author  Topic 

vivo
Starting Member

24 Posts

Posted - 2010-03-31 : 04:20:44

How to format date as
dd/mm/yyyy hh:mm:ss (AM or PM)

I use convert(varchar,ACCIDENT_DATE, 103) but it miss out time part.

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-03-31 : 04:50:14
select convert(varchar,ACCIDENT_DATE,103)+' '+right(convert(varchar,ACCIDENT_DATE,109),14)

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-31 : 04:55:14
quote:
Originally posted by vivo


How to format date as
dd/mm/yyyy hh:mm:ss (AM or PM)

I use convert(varchar,ACCIDENT_DATE, 103) but it miss out time part.


Where do you want to show formatted dates?

Madhivanan

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

- Advertisement -