您的位置:首页 > 数据库

常用的日期格式

2014-10-18 20:00 183 查看
SELECT hiredate,
to_number(to_char(hiredate, 'hh24')) 时,
to_number(to_char(hiredate, 'mi')) 分,
to_number(to_char(hiredate, 'ss')) 秒,
to_number(to_char(hiredate, 'dd')) 日,
to_number(to_char(hiredate, 'mm')) 月,
to_number(to_char(hiredate, 'yyyy')) 年,
to_number(to_char(hiredate, 'ddd')) 年内第几天,
trunc(hiredate, 'dd') 一天之始,
trunc(hiredate, 'day') 周初,
trunc(hiredate, 'mm') 月初,
last_day(hiredate) 月未,
add_months(trunc(hiredate, 'mm'),1) 下月初,
trunc(hiredate, 'yy') 年初,
to_char(hiredate, 'day') 周几,
to_char(hiredate, 'month') 月份
FROM (SELECT hiredate + 30/24/60/60 + 20/24/60 + 5/24 AS hiredate FROM emp WHERE ROWNUM <=1);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  SQL