【问题标题】:Does PostgreSQL have a way to return month names in the local name, not english?PostgreSQL 是否有办法以本地名称而不是英文返回月份名称?
【发布时间】:2020-09-26 17:20:54
【问题描述】:

我需要从查询中返回月份名称。我认为 1 月返回 1,2 月返回 2 并在前端进行处理并不好。我需要以葡萄牙语 Janeiro、Fevereiro 等返回月份名称。PosgreSQL 提供了一种以本地格式返回月份的方法,或者我应该创建一个表吗?这只是好奇,我完全可以手动创建包含几十行的表。

【问题讨论】:

    标签: sql string postgresql datetime


    【解决方案1】:

    您可以使用the TM prefix 以语言环境lc_time 返回日期和月份名称:

    select to_char(current_date, 'dd TMMonth')
    

    lc_time 如果未设置,则从环境继承。您可以使用命令show lc_time 显示其当前值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-23
      • 1970-01-01
      • 2019-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-15
      相关资源
      最近更新 更多