oracle的日期和时间的处理
2016-03-18 22:00
459 查看
sql: with v as (select (e.hiredate+10/24/60/60 +20/24/60 +8/24 ) as hiredate from emp e) select e.hiredate as 日期 , to_char(e.hiredate ,'yyyy') 年, to_char(e.hiredate ,'mm') 月, to_char(e.hiredate ,'dd') 日, to_char(e.hiredate ,'hh24') 时, to_char(e.hiredate ,'mi') 分, to_char(e.hiredate ,'ss') 秒, to_char(e.hiredate ,'ddd') 年内第几天, to_char(e.hiredate ,'day') 周几, to_char(e.hiredate ,'yyyyMMddhh24miss') as 日期格式化, trunc(e.hiredate ,'dd') as 当天, trunc(e.hiredate,'day') as 周初, trunc(e.hiredate,'mm') as 月初, last_day(e.hiredate) as 月末, add_months(trunc(e.hiredate,'mm'),1) as 下月初, trunc(e.hiredate,'yy') as 年初, to_char(e.hiredate,'month') 月份 from v e
--如果你想在你的数据库运行,把这句话with v as (select (e.hiredate+10/24/60/60 +20/24/60 +8/24 ) as hiredate from emp e) 换成 with v as (select sysdate as hiredate from dual)就可以了
结果如下:
一次性截不完,再来一行:
相关文章推荐
- java实现oracle数据库基本操作
- oracle通过dblink连接Mysql
- oracle允许外网链接
- oracle 简单入门
- Python安装cx_Oracle
- 隐藏oracle命令行登陆密码
- oracle word
- Oracle 定时任务的那些事
- oracle——SQL复习06
- Oracle 数据导出工具 Spool
- 关于 ORA - 01861 文字与格式字符串不匹配问题(oracle存储过程)
- oracle instr函数 判断字段中是否有换行符
- Oracle Linux 6.5 安装Oracle 11G 配置安装
- Oracle数据库,数字强制显示2位小数(转)
- oracle 日期格式
- oralce代理用户登录--工作备忘2016/03/09
- 关于oracle的数查询
- Oracle Study之--AIX 6.1安装Oracle 11gR2
- Oracle Study之--AIX 6.1安装Oracle 11gR2
- Oracle 11g学习1——基础介绍