PHP date function
<?php echo date('F j, Y'); ?>
displays the time in the format
February 19, 2012
How to display the same thing in a similar format, but in Russian text?
February 19, 2012
PHP date function
<?php echo date('F j, Y'); ?>
displays the time in the format
February 19, 2012
How to display the same thing in a similar format, but in Russian text?
February 19, 2012
Local time is displayed using a pair of setlocale and strftime functions. First you need to check which locales are on the server.
ls /usr/share/locale | grep 'ru'
Then set the desired locale (for example, if you have ru_RU.UTF-8) and display the formatted date
<?php setlocale(LC_TIME, 'ru_RU.UTF-8'); echo strftime('%B %d, %Y') ?>
Sometimes with locales there are difficulties on different operating systems, then iconv conversion is like, for example:
iconv("cp1251", "UTF-8", strftime("%B %d, %Y"))
The format “% B% d,% Y” is similar, not exactly the one you requested.
in this case, changing the locale will only help with the strftime function.
Source: https://ru.stackoverflow.com/questions/81494/
All Articles