Oracle中时间格式转化

上一篇 / 下一篇  2012-04-10 15:36:05 / 个人分类:数据库

--日期转化为字符串  
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') table1;  

--获取时间的年   
select to_char(sysdate,'yyyy')  from table1; 

--获取时间的月 
select to_char(sysdate,'mm')  from table1;   

--获取时间的日
select to_char(sysdate,'dd')    from table1;     

--获取时间的时 
select to_char(sysdate,'hh24')   from table1;     

--获取时间的分   
select to_char(sysdate,'mi')   from table1;  

--获取时间的秒  
select to_char(sysdate,'ss') from table1; 

TAG: 时间 Oracle oracle

 

评分:0

我来说两句

Open Toolbar