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')