0

I stumbled upon this solution for getting the week-day on my language but I am still trying to find information regarding the pattern needed to do it, as you can see the pattern is "EEEE" if i were to use date() it would be "l". When i tried with "l" i got a empty echoed string.

Can anyone help me?

<?php
setlocale(LC_ALL, 'pt_BR');
date_default_timezone_set('America/Bahia');
$formatter = new IntlDateFormatter('pt_BR',
    IntlDateFormatter::FULL,
    IntlDateFormatter::FULL,
    'America/Bahia',
    IntlDateFormatter::GREGORIAN, "EEEE");
echo $formatter->format(new DateTime("now"));

SHJordan
  • 1
  • 1
  • 1
  • https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/SimpleDateFormat.html has the list of formats – aynber Jan 25 '22 at 13:34
  • It really helped thank you, but is there any doc regarding it on php.net? – SHJordan Jan 25 '22 at 14:21
  • Not sure. I got to that page from https://www.php.net/manual/en/class.intldateformatter.php (the link needs updated, but it got me to the front page of the unicode docs). – aynber Jan 25 '22 at 14:27
  • Yep, link is outdated but the redirect is poiting towards your finding. Thank you @aynber . – SHJordan Jan 25 '22 at 14:52

0 Answers0