sql server 时间查询

Posted 王子先生

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql server 时间查询相关的知识,希望对你有一定的参考价值。

select CONVERT(varchar, getdate(),8 )   --获取当前时间时分14:13:59

select CONVERT(varchar, getdate(),23 )  -获取年月 2017-07-01

select CONVERT(varchar, getdate(),12 )  -获取年月 170701

select CONVERT(varchar, getdate(),121 )  --获取年月日时分秒毫秒2017-07-01 14:18:47.960

select CONVERT(varchar, getdate(),120 )  --获取年月日时分秒2017-07-01 14:18:47

 select CONVERT(varchar(12) , getdate(), 112 )  -获取年月日20170701

select CONVERT(varchar(12) , getdate(), 101 )  -获取年月日  07/01/2017

select CONVERT(varchar(12) , getdate(), 103 )   -获取年月日01/07/2017

select CONVERT(varchar(12) , getdate(), 104 )   -获取年月日01.07.2017

select CONVERT(varchar(12) , getdate(), 105 ) --12-09-2004

select CONVERT(varchar(12) , getdate(), 106 ) --12 09 2004


select CONVERT(varchar(12) , getdate(), 107 ) --09 12, 2004


select CONVERT(varchar(12) , getdate(), 108 ) --11:06:08


select CONVERT(varchar(12) , getdate(), 109 ) --09 12 2004 1


select CONVERT(varchar(12) , getdate(), 110 ) --09-12-2004


select CONVERT(varchar(12) , getdate(), 113 ) --12 09 2004 1


select CONVERT(varchar(12) , getdate(), 114 )-- 11:06:08.177

 







以上是关于sql server 时间查询的主要内容,如果未能解决你的问题,请参考以下文章

SQL 查询执行时间、SQL Server、嵌套查询

SQL Server 查询因 RODBC 连接而失败,在 SQL Server 中工作

sql server查询问题。

SQL server查看查询所用时间

SQL 查询在 SQL Server CE 中很慢,但在 SQL Server 中很快

sql server 时间查询