2014-09-03 72 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

相關問題