我有数据库,其中插入了此格式的时间戳(6): 18-AUG-14 02.49.27.000000000 PM
。从时间戳中提取年份和月份(6)
我想将它解压到这一点:2014-08
其所谓的ISO 8601
我有数据库,其中插入了此格式的时间戳(6): 18-AUG-14 02.49.27.000000000 PM
。从时间戳中提取年份和月份(6)
我想将它解压到这一点:2014-08
其所谓的ISO 8601
你需要使用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
);
这将使2014-8,不2014-08。 – 2014-09-03 12:38:24
即时通讯对不起,也许我把“抽取”这个词弄糊涂了...... @ KimBergHansen是对的,它没有ISO格式 – 2014-09-03 12:48:44
优秀,在6分钟内我将迎来答案:)日Thnx – 2014-09-03 12:30:23
@MartinKóňa欢迎您:) – Sathya 2014-09-03 13:20:32