您的位置:首页 > 数据库 > Oracle

oracle 数据库使用记录,mybatis

2016-04-11 14:49 471 查看
<isNotEmpty prepend="and" property="threeRecptDate1"> property里的是传过来的属性名

STA.LAST_UPDATE_DATE <![CDATA[>=]]>

to_date(#threeRecptDate1#,'YYYY-MM-DD HH24:mi:ss')

</isNotEmpty>

<isNotEmpty prepend="and" property="threeRecptDate2">

STA.LAST_UPDATE_DATE <![CDATA[<=]]>

to_date(#threeRecptDate2#,'YYYY-MM-DD HH24:mi:ss')

</isNotEmpty>

24小时的形式显示出来,date转string

select to_char(date,'yyyy-MM-dd HH24:mi:ss') from table;

即实际语句可能从数据库取出日期然后格式化

string转date

select to_date('2016-01-01 23:59:59','yyyy-MM-dd HH24:mi:ss') from table;

1.日期到字符操作

select sysdate,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from table

select sysdate,to_char(sysdate,'yyyy-mm-dd hh:mi:ss') from table

select sysdate,to_char(sysdate,'yyyy-ddd hh:mi:ss') from table

select sysdate,to_char(sysdate,'yyyy-mm iw-d hh:mi:ss') from table

2.字符到日期操作

select to_date('2016-01-01 23:59:59','yyyy-MM-dd HH24:mi:ss') from table;

3.oracle有毫秒级的数据类型

--返回当前时间年月日小时分秒毫秒

select to_char(current_timestamp(5),'DD-MON-YYYY HH24:MI:SSxFF') from table;

--返回当前时间的秒毫秒,可以指定秒后面的精度(最大=9)

select to_char(current_timestamp(9),'MI:SSxFF') from table;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: