2014-09-03 111 views

回答

1

你需要使用to_char功能从时间戳提取年月。

select to_char(timestamp, 'yyyy-mm') from your_table 
+0

优秀,在6分钟内我将迎来答案:)日Thnx – 2014-09-03 12:30:23

+0

@MartinKóňa欢迎您:) – Sathya 2014-09-03 13:20:32

-1

我以这种方式做到了这一点 -

select extract(year from timestmp) || '-' || extract(month from timestmp) from texmp1; 

希望这有助于。

这里是表结构:

create table texmp1 
(
timestmp timestamp 
); 
+2

这将使2014-8,不2014-08。 – 2014-09-03 12:38:24

+0

即时通讯对不起,也许我把“抽取”这个词弄糊涂了...... @ KimBergHansen是对的,它没有ISO格式 – 2014-09-03 12:48:44