Martin Edlman
Martin Edlman

Reputation: 753

PostgreSQL to_char ignores locale

I have PgSQL 9.6 on Fedora 29. System and PgSQL is running with cs_CZ.UTF-8 locale. But when I use to_char(date, 'Day Dy') I get english day name.

#shell> echo $LANG
cs_CZ.utf8

#sql> show lc_time;
cs_CZ.UTF-8
#sql> select to_char(now()::date, 'Day Dy');
Monday    Mon
#sql> set lc_time to 'it_IT.utf8';
#sql> show lc_time;
it_IT.utf8
#sql> select to_char(now()::date, 'Day Dy');
Monday    Mon

Is there anything I can set to make it working?

Upvotes: 1

Views: 1889

Answers (1)

Martin Edlman
Martin Edlman

Reputation: 753

I have missed the 'TM' modifier, so the correct format is

#sql> select to_char(now()::date, 'TMDay TMDy');
Pondělí Po

Upvotes: 4

Related Questions