P
P
Pavel K2015-01-02 18:20:23
PHP
Pavel K, 2015-01-02 18:20:23

How to russify date output in php?

In general, I installed php-fpm + nginx
the last glitch in that the output of php date / strftime does not want the month and day in Cyrillic
, the output of locale -a says that there is ru_RU.utf8,
I set LANG=ru_RU in /etc/default/locale. UTF-8
is still nothing, where you can drop it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
OnYourLips, 2015-01-02
@PavelK

How to russify date output in php?
The only correct solution is through JS on the client side.
On the server, give in ISO 8601 in UTC, format it on the client.

R
Robot, 2015-01-02
@iam_not_a_robot

Output as a number and in JS convert to Russian

M
Maxim Nosachov, 2015-01-02
@Hold-Fast

We cling to the locale from the operating system:
setlocale(LC_ALL,"russian");
Keep in mind that not all date functions understand locales.
Use strftime("%Y-%m-%d").
But bugs are still possible.
Therefore, the output of the date in symbolic form (the names of the months) is better to process through an array where to set the correspondence of the month number => month name.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question