如何更改其他语言PostgreSQL中的时间戳格式

如何更改其他语言PostgreSQL中的时间戳格式,postgresql,timestamp,diff,subtraction,Postgresql,Timestamp,Diff,Subtraction,PostgreSQL时间戳: begin= '2018-06-07 08:29:49' end = '2018-06-10 04:07:57' 查询: select sa.\"end\"::timestamp(0) - sa.begin::timestamp(0) from tabelle sa; 输出: 2天19:38:08 我想将此输出“天”更改为“天”,如: 2:19:38:08 最重要的是,当月份不同时,它应该在“Monate”中显示月份,而在“Jahre”中则是如此 我试图查看d

PostgreSQL时间戳:

begin= '2018-06-07 08:29:49'
end  = '2018-06-10 04:07:57'
查询:

select sa.\"end\"::timestamp(0) - sa.begin::timestamp(0)
from tabelle sa;
输出:

2天19:38:08

我想将此输出“天”更改为“天”,如:

2:19:38:08

最重要的是,当月份不同时,它应该在“Monate”中显示月份,而在“Jahre”中则是如此

我试图查看dateformat,但我需要更改expr格式,而不是像“%Y%m%d”这样的格式…等等

我也试过:

to_char(extract(year from (sa."end"::timestamp - sa.begin::timestamp)),'00')||' Jahre '||to_char(extract(month from (sa."end"::timestamp - sa.begin::timestamp)),'00')||' Monate '||to_char(extract(day from (sa."end"::timestamp - sa.begin::timestamp)),'00')||' Tage '||to_char(extract(hour from (sa."end"::timestamp - sa.begin::timestamp)),'00')||':'||to_char(extract(minute from (sa."end"::timestamp - sa.begin::timestamp)),'00')||':'||to_char(extract(second from (sa."end"::timestamp - sa.begin::timestamp)),'00')
输出:

00 Jahre 00 Monate 02 Tage 19:38:08

它看起来不太好,因为如果有数字,月份或年份就会出现

重要的是,只有这一天需要在“Tage”中更改,而不是设置字符UFT8或其他德语完整的内容


我需要您的支持。

有一些解决方案,但另一方面:

select extract(day from (sa.\"end\"::timestamp - sa.begin::timestamp))||' Tage '||
       to_char(extract(hour from (sa.\"end\"::timestamp-sa.begin::timestamp)),'00')||':'||
       to_char(extract(minute from (sa.\"end\"::timestamp - sa.begin::timestamp)),'00')||':'||
       to_char(extract(second from (sa.\"end\"::timestamp - sa.begin::timestamp)),'00')
       from tabelle sa
输出:

2:19:38:08


可能是Hello Georgie的副本,不,这不一样,我不想用德语设置ufc!但只有这种类型的“天”可以更改!它是复制品。您可以执行如下操作:
SET lc_time='de_de';选择你的东西;将lc\U时间设置为默认值