查询今天的内容: select * from tablename a where to_char(a.日期字段,'yyyy-mm-dd')=to_char(sysdate,'yyyy-mm-dd')
select * from tablename a where trunc(a.日期字段,'yyyy-mm-dd')
select * from tablename a where trunc(a.日期字段)=to_data('20040831','yyyymmdd')
select * from Work where time=to_date('2004-08-31','yyyy-mm-dd')
你的日期字段不知道是怎么定义的,我一般对经常查询的字段定义为字段型,然后进行转换。 比如select * from tablename a where a.日期字段=to_char(sysdate,'yyyymmdd') 。如果是日期类型那么你就利用 to_char 和 to_date 两个函数进行嵌掏转换。
select sysdate from dual 可以用TO_CHAR,TO_DATE为格式化你要的日期形式.
1.在应用程序中是否可用一个变量存放由sysdate得到的系统时间,并且java中这个变量是什么类型?
2.在oracle中能否有一个得到当前日的时间(精确到日)?
希望大家指点,分不够可以加!
谢谢!!!
select * from tablename a where to_char(a.日期字段,'yyyy-mm-dd')=to_char(sysdate,'yyyy-mm-dd')
比如select * from tablename a where a.日期字段=to_char(sysdate,'yyyymmdd')
。如果是日期类型那么你就利用 to_char 和 to_date 两个函数进行嵌掏转换。
可以用TO_CHAR,TO_DATE为格式化你要的日期形式.