Java存到Oracle
java的日期值:
SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date(dateString));
格式化函数:
to_timestamp(to_date('value','yyyy-MM-dd hh24:mi:ss'))
Sql:
insert into (value) values (to_timestamp(to_date('value','yyyy-MM-dd hh24:mi:ss')))
Oracle日期转换成java日期
String registertime = "2018-08-28T07:29:51.000+0000";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format1 = format.format(registertime);
Date format2 = format.parse(registertime);
System.out.println(format1);
System.out.println(format2);
输出结果为:
2018-08-28 15:29:51
Tue Aug 28 15:29:51 CST 2018
日期值转换成字符
SELECT to_char(DATE,'yyyy-mm-dd hh24:mi:ss') TIME FROM dual;