(亲测在navicat客户端实现)
- oracle数据库:
select * from 表名 where createTime(时间字段)=to_date('2020-09-17','yyyy-MM-dd');
to_date将字符串时间转换为date类型,并作为条件查询
select to_char(sysdate,'YYYYMMDD HH24:MI:SS') from dual; //取得当前日期
to_char将date类型转换为字符串类型
- mysql数据库:
select * from 表名 where createTime(时间字段)=str_to_date('2020-09-17','%y-%m-%d')
str_to_date将字符串时间转换为date类型,并作为条件查询
select date_format(sysdate,'%Y-%m-%d %H:%m:%s') from dual;
date_format将date类型转换为字符串类型