Oracle关于时间的处理,日期参数在SQL中的处理

xiaoxiao2025-01-31  14

//ok:select u.investigation_time from t_customer u where TO_CHAR(u.investigation_time,'YYYY-MM-DD')  like '"+参数值+"%'  //NO:select u.investigation_time from t_customer u where u.investigation_time like TO_DATE('"+参数值+"%','YYYY-MM-DD')  //ok:UPDATE  t_customer SET investigation_time=TO_DATE('2008-12-12','YYYY-MM-DD') WHERE customer_id=2//OK;temp.append(" AND TO_CHAR(u.investigation_time,'YYYY-MM-DD')  like '"+investigation_time+"%'");//NO:temp.append(" AND u.investigation_time LIKE TO_DATE('"+investigation_time+"%','YYYY-MM-DD') ");

 

1.以12小时制显示     SQL>select to_char(sysdate,'YYYY-MM-DD HH12:MI:SS AM')from dual;

2.以24小时制显示

 SQL>  select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS AM')from dual;

3.得到当前时间的后一天

select to_char(Sysdate+1,'YYYY-MM-DD')from dual;

 

timestamp类型的日期转换显示

select to_char(createdtime,'yyyy-mm-dd hh24:mi:ssxff3')createdtime,content,type from log order by createdtime desc

相关资源:敏捷开发V1.0.pptx
转载请注明原文地址: https://www.6miu.com/read-5023614.html

最新回复(0)