Oracle function : to_date and to_char

First,here are some defination of date.

  D :the day number of the week,example: Monday is two
  DAY :the day name ,example:Monday
  DD :  the day number of the month,from 0 to 31
  DDD : the day number of the year, from 0 to 365
  DY :  the day name for shot.
  IW :  the week number of the year(ISO standard)
  IYYY :  the year of ISO standard
  YYYY :  the year
  YYY,YY,Y :  the last three,two,one number of the year
  HH :  stand for the hour,0-12
  HH24 :  stand for the hour,0-24
  MI :  minute
  SS :  second
  MM :  month
  Mon : the month name for short
  Month :  the month name
  W :  the week number of the month
  WW : the week number of year

then some examples on oracle:

select sysdate,to_char(sysdate,'yyyy-mm-dd hh:mi:ss') from dual
2009-12-17 16:40:51  2009-12-17 04:40:51
select sysdate,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual
2009-12-17 16:40:21  2009-12-17 16:40:21
select sysdate,sysdate - interval '7' minute from dual
2009-12-17 16:37:14  2009-12-17 16:30:14
select sysdate,sysdate - interval '1' day from dual
2009-12-17 16:58:31  2009-12-16 16:58:31
select sysdate,to_char(sysdate,'yyyy-ddd hh:mi:ss') from dual
2009-12-17 16:53:28  2009-351 16:53:28
select sysdate,to_char(sysdate,'yyyy-dy hh24:mi:ss') from dual
2009-12-17 16:56:27  2009-星期四 16:56:27

insert into t_log values(4,to_date('2007-10-10 15:32:32','yyyy-MM-dd hh24:mi:ss'),'log of 2007')

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值