Home  >  Article  >  Database  >  SqlServer中插入无时间的日期

SqlServer中插入无时间的日期

WBOY
WBOYOriginal
2016-06-07 15:51:211370browse

很简单你可以用: SELECT DATEADD(dd, DATEDIFF(dd, '2000-01-01 00:00:00' , GETDATE() ), '2000-01-01 00:00:00' ); 这样也可以: SELECT DATEADD( DAY ,DATEDIFF( DAY ,0,GETDATE()),0) 结果是: 2009-11-15 00:00:00.000(这是今天的日期) Author:Petter

很简单你可以用:

<span>SELECT</span> DATEADD(dd, DATEDIFF(dd, <span>'2000-01-01 00:00:00'</span>, GETDATE() ), <span>'2000-01-01 00:00:00'</span> );

这样也可以:

<span>SELECT</span> DATEADD(<span>DAY</span>,DATEDIFF(<span>DAY</span>,0,GETDATE()),0)

结果是:

2009-11-15 00:00:00.000(这是今天的日期)

Author:Petter Liu  http://wintersun.cnblogs.com

希望对您有帮助!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn