Convert datetime field in sql server 2005
I have开发者_开发技巧 a datetime field which has a value like this 5/11/2010 12:04:20 PM
.... I am converting this field convert(varchar, dbo.Clients.CreatedDate,103) as CreatedDate
and i get the result as 11/5/2010
..... But how to get 11/5/2010 12:04 PM
.....
You can use a different formatting style to include the time component.
For example:
convert(varchar, dbo.Clients.CreatedDate, 131)
All styles are documented here:
http://msdn.microsoft.com/en-us/library/ms187928.aspx
精彩评论