Oracle 从时间戳中提取年和月(6)
我有一个数据库,我在其中插入了以下格式的时间戳(6):Oracle 从时间戳中提取年和月(6),oracle,timestamp,extract,iso8601,Oracle,Timestamp,Extract,Iso8601,我有一个数据库,我在其中插入了以下格式的时间戳(6): 2014年8月18日02.49.27.000000000下午 我想把它浓缩到这个:2014-08 它名为ISO 8601,您需要使用该函数从时间戳中提取年-月 select to_char(timestamp, 'yyyy-mm') from your_table 我是这样做的- select extract(year from timestmp) || '-' || extract(month from timestmp) from t
2014年8月18日02.49.27.000000000下午
我想把它浓缩到这个:2014-08
它名为ISO 8601,您需要使用该函数从时间戳中提取年-月
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年。对不起,也许我把你和“摘录”这个词混淆了…@KimBergHansen是对的,它不是ISO格式