【发布时间】:2014-09-03 12:22:24
【问题描述】:
我有数据库,我以这种格式插入了时间戳(6):
18-AUG-14 02.49.27.000000000 PM.
我想把它提取到这个:2014-08
它被称为 ISO 8601
【问题讨论】:
标签: oracle timestamp extract iso8601
我有数据库,我以这种格式插入了时间戳(6):
18-AUG-14 02.49.27.000000000 PM.
我想把它提取到这个:2014-08
它被称为 ISO 8601
【问题讨论】:
标签: oracle timestamp extract iso8601
您需要使用to_char 函数从时间戳中提取年月。
select to_char(timestamp, 'yyyy-mm') from your_table
【讨论】:
我是这样做的-
select extract(year from timestmp) || '-' || extract(month from timestmp) from texmp1;
希望这会有所帮助。
这是表结构:
create table texmp1
(
timestmp timestamp
);
【讨论】: