当前位置:Gxlcms > 数据库问题 > oracle日期格式

oracle日期格式

时间:2021-07-01 10:21:17 帮助过:18人阅读

1.转换函数

 与date操作最大关系的就是2个转换函数:to_date()   to_char()

to_date() 就是将字符类型安按照一定格式转换日期类型

比如:to_date(‘2016-04-15 00:00:00‘,‘yyyy-mm-dd hh24:mi:ss‘) 前者为字符串,后者转换日期格式

 

2.to_char() :将日期转换一定格式转换字符类型

 比如:to_char(sysdate,‘yyyy-mm-dd hh24:mi:ss‘) time from

select count(*)  
      from ( select rownum-1 rnum  
      from all_objects  
      where rownum <= to_date(‘‘2002-02-28‘‘,‘‘yyyy-mm-dd‘‘) - to_date(‘‘2002-  
      02-01‘‘,‘‘yyyy-mm-dd‘‘)+1  
      )  
      where to_char( to_date(‘‘2002-02-01‘‘,‘‘yyyy-mm-dd‘‘)+rnum-1, ‘‘D‘‘ )  
      not  
      in ( ‘‘1‘‘, ‘‘7‘‘ )        查找2002-02-28至2002-02-01间除星期一和七的天数 

 

 

oracle日期格式

标签:char   tom   objects   类型   oracle   日期类   family   acl   har   

人气教程排行