0
点赞
收藏
分享

微信扫一扫

SQLServer 常用时间格式转换

guanguans 2022-10-11 阅读 188

使用:CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

使用 CONVERT 处理不同格式的 datetime 数据

从 GETDATE() 值开始,此示例使用CONVERT 显示本文日期和时间样式部分的所有日期和时间样式。

SQLServer 常用时间格式转换_数据

实例:

select Category,accounttype,paytype ,SUM(PayMoney) AS 'PayMoney' ,convert(nvarchar,a.CreateTime,23) from C_Fund_Detail A ,C_User_Register B

WHERE

--A.CreateTime >=:startTime  AND A.CreateTime<=:endTime AND

A.UserId = B.UserId AND B.usertype = 0

GROUP BY Category,accounttype,paytype,convert(nvarchar,a.CreateTime,23) ORDER BY Category, accounttype, paytype

SQLServer 常用时间格式转换_数据_02

举报

相关推荐

0 条评论