postgresql 中 mmm yyyy 格式的日期 [英] Date in mmm yyyy format in postgresql

查看:68
本文介绍了postgresql 中 mmm yyyy 格式的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,其中包含一个没有时区的时间戳类型的列.

I have a table with a column of type timestamp without time zone.

我想选择具有 mmm yyyy 格式的列 - 例如,Mar 2011".如何以这种方式格式化?我试过了:

I want to select that column with the mmm yyyy format – for example, "Mar 2011". How to format it that way? I tried:

select cast(now() as date)

但它给了我不正确的格式.

but it is giving me the incorrect format.

推荐答案

SELECT TO_CHAR(NOW(), 'Mon YYYY');

这篇关于postgresql 中 mmm yyyy 格式的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆