Oracle:时间戳
来源:互联网 发布:卷皮折扣和淘宝那个好 编辑:程序博客网 时间:2024/06/10 07:04
与时间戳有关的函数:
1.CURRENT_TIMESTAMP/LOCALTIMESTAMP和SYSTIMESTAMP
select CURRENT_TIMESTAMP,LOCALTIMESTAMP,SYSTIMESTAMP from dual;CURRENT_TIMESTAMP LOCALTIMESTAMP SYSTIMESTAMP------------------------------------------------06-11月-17 09.41.45.024436 上午 +08:00 06-11月-17 09.41.45.024436 上午 06-11月-17 09.41.45.024423 上午 +08:00
2.EXTRACT()
select extract (year from sysdate ) from dual;EXTRACT(YEARFROMSYSDATE)-------------------------2017
3.FROM_TZ()
FROM_TZ(x, time_zone):将timestamp类型的x转换为由time_zone指定的时区,并返回一个timestamp with timezone类型的值。就是将x和time_zone合并
select from_TZ(timestamp '2017-10-23 09:13:31.1234', '-7:00') as fromTZ from dual;FROMTZ-----------------------------------------23-10月-17 09.13.31.123400000 上午 -07:00
4.SYS_EXTRACT_UTC()
SYS_EXTRACT_UTC(x):用于将timestamp with timezone类型的x转换为UTC时区日期和时间的timestamp类型。
select SYS_EXTRACT_UTC(timestamp '2017-10-23 09:13:31 PST') as SYSEXTRACTUTC from dual;SYSEXTRACTUTC----------------------------------23-10月-17 04.13.31.000000000 下午
5.TO_TIMESTAMP()
TO_TIMESTAMP(x):用于将x转换为timestamp类型。
select TO_TIMESTAMP('2017-10-23 09:13:31', 'YYYY-MM-DD HH24:MI:SS.FF') as TOTIMESTAMP from dual;TOTIMESTAMP---------------------------------------23-10月-17 09.13.31.000000000 上午
6.TO_TIMESTAMP_TZ()
TO_TIMESTAMP_TZ(x):用于将x转换为timestamp with timezone类型。
select TO_TIMESTAMP_TZ('2017-10-23 09:13:31 PST', 'YYYY-MM-DD HH24:MI:SS.FF TZR') as TOTIMESTAMPTZ from dual;TOTIMESTAMPTZ---------------------------------------23-10月-17 09.13.31.000000000 上午 PST
7.CAST()
CAST():将字符串转换为timestamp with local time zone类型
select cast(to_timestamp_TZ('2017-12-10 13:10:34.1234 PST','YYYY-MM-DD HH24:MI:SS.FF TZR') as timestamp with local time zone) as castTemp from dual;CASTTEMP---------------------------------------11-12月-17 05.10.34.123400 上午
阅读全文
0 0
- oracle 时间戳TIMESTAMP
- Oracle:时间戳
- Oracle 时间戳 日期
- oracle unix时间戳格式化
- ORACLE----TimeStamp(时间戳)自动更新
- Oracle 时间
- oracle时间
- oracle时间
- oracle 时间
- Oracle 时间
- Oracle时间与Unix时间戳的转换
- Oracle时间与Unix时间戳的转换
- oracle将时间转成unix时间戳形式
- oracle timestamp 时间戳增加一天
- Oracle时间戳与毫秒值
- Oracle 日期类型 转 时间戳
- Oracle 业务表添加时间戳触发器
- Oracle 创建带时间戳的表
- sql语言简单应用
- SSL2837 2017年11月6日提高组T1 互质(math)
- AVL树
- VINS技术路线与代码详解
- 用栈来进行数字的进制转换
- Oracle:时间戳
- Dialvik/ARP(ANDROID)中的多线程机制(2)
- netty对http协议解析原理解析
- 【减治法】插入排序及C++代码实现
- 基础练习 完美的代价(蓝桥杯 字符串问题)
- cygwin工具安装使用
- 最少货币数问题
- 进程fork和vfork函数复习
- Dialvik/ARP(ANDROID)中的多线程机制(3)