lonelystar
select  CAST(FLOOR( CAST( getdate()  AS FLOAT )) AS DATETIME)


结果2008-06-23 00:00:00.000



T-SQL中,时间日期格式数据类型实际上是一个浮点数类型,记录的是当前时间到1900110时的天数,加上剩余的时间化成小数.

FLOOR ( numeric_expression ) ,返回小于或等于给定数字表达式的最大整数。
SELECT FLOOR(123.45), FLOOR(-123.45), FLOOR($123.45)
SELECT FLOOR(123.55), FLOOR(-123.55), FLOOR($123.55)


The result is the integer portion of the calculated value in the same data type as numeric_expression.

---------      ---------     -----------
123            -124          123.0000

相关参考资料:SQL Server时间格式浅析

 

select DATEADD(dd,  DATEDIFF(dd,0,getdate()),  0), getdate()

 

分类:

技术点:

相关文章:

  • 2022-02-03
  • 2021-09-23
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2021-12-30
  • 2021-12-17
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-01-25
相关资源
相似解决方案