Home > Database > Mysql Tutorial > body text

SqlServer中插入无时间的日期

WBOY
Release: 2016-06-07 15:51:21
Original
1369 people have browsed it

很简单你可以用: 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> );
Copy after login

这样也可以:

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

结果是:

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

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

希望对您有帮助!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!