在VS中对oracle时间查询 tochar与todate
并且在使用时,todate和tochar 如果使用从oracle中查询得到的时间,再做为where的查询条件,进行新的查询, 要使用todate select * from tabletest where t.time=to_date('"+obtaintime+"','yyyy-mm-dd hh24:mi:ss') 因为从oracle中获得的时间格式如2013/7/11 8:00:00 而select中需要的t.time字段的格式为2013-07-11 08:00,使用todate可自动补足格式。 但是!如果使用 where to_char(t.time,'yyyy-mm-dd hh24:mi')='" + obtaintime+ "'"; ,则在oracle中查询不到数据,显示记录数为0 to_date()与24小时制表