M
M
Maxim Tyulpakov2015-10-30 10:42:10
PHP
Maxim Tyulpakov, 2015-10-30 10:42:10

How to decline the name of the month without crutches?

How to incline the date? I call in the standard way:
It turns out October 30, 2015
But I need October 30, 2015

<?php 
              setlocale(LC_ALL, "russian");
              $mon = strftime('%B');
              $day = strftime('%d');
              $year = strftime('%Y');
              $mon = iconv('windows-1251', 'UTF-8', $mon);
              echo 'сегодня',' ',$day,' ',$mon,' ',$year;
            ?>

There are examples of self-written functions on the Internet, but it seems to me that there should be a ready-made solution. So I'm trying my luck here.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey, 2015-10-30
@MaXComp

in the case of today............ no need to inflect anything, for any number of any month, the name of the month is the same, whether it is October 1 or October 30.
Create an array of ready-made titles

C
Cole, 2015-10-30
@Cole

And why do you need examples of self-written functions not a ready-made solution?

S
shagguboy, 2015-10-30
@shagguboy

symfony component has
https://github.com/symfony/intl

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question