oracle 从时间戳中提取年和月(6)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25644216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:29:33 来源:igfitidea点击:
Extract year and month from timestamp(6)
提问by Martin Kóňa
I have database, where i have inserted timestamps(6) in this format :
18-AUG-14 02.49.27.000000000 PM
.
我有数据库,其中i在这个格式插入时间戳(6):
18-AUG-14 02.49.27.000000000 PM
。
I want to extract it into this: 2014-08
我想把它提取成这个:2014-08
Its called ISO 8601
它被称为 ISO 8601
回答by Sathyajith Bhat
回答by iSaumya
I've done this in this way -
我是这样做的——
select extract(year from timestmp) || '-' || extract(month from timestmp) from texmp1;
Hope this helps.
希望这可以帮助。
Here is the table structure:
这是表结构:
create table texmp1
(
timestmp timestamp
);