不同数据库中,针对日期处理的函数不同

Oracle中常用日期函数

  (1sysdate

  获取当前系统时间

  如:

  select sysdate()

  ----返回当前时间,包括年月日 时分秒

  (2to_date('字符类型','日期类型')

  将字符串类型转换日期类型

  如:

  select * from ticket where create_date=to_date('2019-01-01','yyyy-mm-dd')

  ---查询出,create_date2019-01-01的数据

  (3to_char('日期类型','字符格式')

  将日期类型转换为字符类型

  如:

  select * from ticket where to_char(create_date,'yyyy')>2000

  ---查询出create_date中年份大于2000的数据

 

相关文章:

  • 2021-11-01
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2021-06-30
  • 2021-06-02
猜你喜欢
  • 2022-01-09
  • 2021-12-09
  • 2021-06-24
  • 2022-12-23
  • 2021-10-18
相关资源
相似解决方案