0

For some reason i cant make date Formatter to work.

Here is my function:

  function renderDate($format, $date)
  {
      $cal = IntlCalendar::fromDateTime($date);
      return IntlDateFormatter::formatObject($cal, $format);
  }

Here is the code:

      for ($i = 1; $i <= 12; $i++) {
          echo renderDate("MMMM", date('M', mktime(0, 0, 0, $i))) . "<br>";
      }

I end up getting :

January
March
March
May
May
July
July
August
October
October
December
December

This is on Windows 10 using WAMP 5.5.12 Default locale are set to en_Ca, and time zone is correct as well America/Toronto

Alko
  • 1,421
  • 5
  • 25
  • 51

1 Answers1

0

You need to put day to mktime function:

mktime(0, 0, 0, $i, 1)
blastar
  • 1
  • 3