开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜