三种数据库日期转换对照:
http://blog.csdn.net/zljjava/article/details/17552741
SQL类型转换函数:cast(type1 as type2)
数据库中的日期类型
SQL SERVER
DATE 1970-01-01
DATETIME 1970-01-01 00:00:00
Oracle
DATE 2015-08-07 17:34:37
TIMESTAMP 1970-01-01 00:00:00.000000 是DATE的扩展类型,多了小数秒
日期转字符串
oracle
to_char(sysdate,’yyyy-mm-dd’)
select to_char(sysdate,’yyyy-mm-dd hh24:mi:ss’) as nowTime from dual;
sql server
convert(varchar, cast(‘1970-01-01’ as datetime) , 120) 1970-01-01 00:00:00
select convert(char(7),getdate(),20); --2015-10
SELECT CAST( DATEPART(yyyy,getdate()) as CHAR(4)) + cast( DATEPART(mm,getdate()) as char(2)); -- 201510
Select CONVERT(varchar(100), GETDATE(), 23) --2006-05-16
http://www.cnblogs.com/zhangq723/archive/2011/02/16/1956152.html
mysql
date_format(sysdate(),’%Y-%m-%d’);
字符串转日期
oracle
to_date(sysdate,’yyyy-mm-dd’)
select to_timestamp(‘2012-5-13 18:45:34:567’,’yyyy-mm-dd hh24:mi:ss:ff9’)+0 from dual;
mysql
STR_TO_DATE(sysdate(),'%Y-%m-%d');
数字转为字符串
oracle
(1)使用TO_CHAR函数处理数字
TO_CHAR(number, ‘格式’)
TO_CHAR(salary,’$99,999.99’);
(2)使用TO_CHAR函数处理日期
TO_CHAR(date,’格式’);
to_char(sysdate,’q’) 季
to_char(sysdate,’yyyy’)年
to_char(sysdate,’mm’)月
to_char(sysdate,’dd’)日
to_char(sysdate,’d’)星期中的第几天
to_char(sysdate,’DAY’)星期几
to_char(sysdate,’ddd’)一年中的第几天
MySQL python安装
pip安装-python2.7.15
接口测试-HTTP重点知识及 测试工具
接口测试-基础
关闭win10的自动更新功能
高版本MySQL(5.7,5.8)的JDBC连接新问题
错误:java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
Idea SpringBoot工程提示 "Error running 'xxxx'": Command line is too long... 问题解决
错误:23:36:21.161 [main] ERROR org.springframework.boot.SpringApplication