阅读背景:

将日期时间值舍入到最接近的半小时

来源:互联网 

I have a requirement to round a datetime2 value down to the nearest half hour. For example '10/17/2013 12:10:00.123' would round down to '10/17/2013 12:00:00.0' And '10/17/2013 12:34:17.123' would round down to 10/17/2013 12:30:00.0'. My first thought was to create a UDF which would break the date and time apart and do it that way. However, I'm wondering if something like this can be done in a single T-SQL statement? I have a requirement to round a datetime2 value




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: