sql日期格式大全
来源:互联网 发布:入门级耳机 知乎 编辑:程序博客网 时间:2024/06/05 18:01
在sql中,smalldatetime及datetime型的数据显示不是那么让人满意,因此我找了些格式化的方法列出来"
convert(char(10),datetime,101)
在数据库取出来的时候就转换好
select getdate()
2006-05-12 11:06:08.177
我整理了一下SQL Server里面可能经常会用到的日期格式转换方法:
举例如下:
select Convert(varchar(10),getdate(),120)
2006-05-12
select CONVERT(varchar, getdate(), 120 )
2006-05-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
20060512110608
select CONVERT(varchar(12) , getdate(), 111 )
2006/05/12
select CONVERT(varchar(12) , getdate(), 112 )
20060512
select CONVERT(varchar(12) , getdate(), 102 )
2006.05.12
其它几种不常用的日期格式转换方法:
select CONVERT(varchar(12) , getdate(), 101 )
0612/2005 select CONVERT(varchar(12) , getdate(), 103 )
12/09/2004
select CONVERT(varchar(12) , getdate(), 104 )
12.05.2006
select CONVERT(varchar(12) , getdate(), 105 )
12-05-2006
select CONVERT(varchar(12) , getdate(), 106 )
12 05 2006
select CONVERT(varchar(12) , getdate(), 107 )
05 12, 2006
select CONVERT(varchar(12) , getdate(), 108 )
11:06:08
select CONVERT(varchar(12) , getdate(), 109 )
0512 2006 1
select CONVERT(varchar(12) , getdate(), 110 )
09-12-2004
select CONVERT(varchar(12) , getdate(), 113 )
12 052006
select CONVERT(varchar(12) , getdate(), 114 )
11:06:08.177
- sql日期格式大全
- SQL日期格式大全
- SQL语句 日期格式大全
- sql server日期格式转换方法大全
- SQL日期时间格式自由转换大全
- SQL日期时间格式转换大全
- sql server 日期格式转换大全
- sql日期时间格式转换大全
- SQL Server 日期格式转换(Convert)用法大全
- C# 日期格式大全
- C#日期格式大全
- C#日期格式大全
- C# 日期格式大全
- C# 日期格式大全
- ios日期格式大全
- sql日期格式转换
- sql日期格式转换
- sql日期格式转换
- __cplusplus和__STDC__
- 招聘职位: C语言开发人员
- 关于SSL
- chunked编码中遇到的问题
- 更新记录后关闭子窗口并刷新父窗口的Javascript
- sql日期格式大全
- C#下读写INI文件
- 深入探讨Iterator模式
- “同一信道”带来层状无线架构
- 使用 HttpWebRequest 轻松实现站外提交(可用于自动登陆,自动网上投票等)
- javascript 让所有页面内容都有淡入淡出效果
- 笑话-女老师和男学生在生理课上的经典对白
- 用 Javascript 和 CSS 实现脚注(Footnote)效果
- 重要书籍参考