Oracle
日期转为字符串:
to_char(date, format)
1
select sysdate,to_char(sysdate,'yyyymmdd hh24:mi:ss')from dual;
字符串转为日期:
to_date(string, format)
1
select sysdate,to_date('20170615','yyyy-mm-dd hh24:mi:ss')from dual;
MySQL
日期转为字符串:
date_format(date, format)
1
select date_fromat(sysdate(),'%Y-%m-%d %H:%i:%s') as result
字符串转为日期:
str_to_date(string, format)
1
select str_to_date('20191225111111', '%Y%m%d%H%i%s') as result