Issue
[PHP 8.0] I want to temporary change language just for displaying month as a word. And this works:
$fmt = new \IntlDateFormatter('Fi_FI', NULL, NULL);
$fmt->setPattern('d MMM yyyy');
echo $fmt->format(new \DateTime($w_date));
This gives me
10 toukok. 2002
But I want it to say Toukok with uppercase on first letter. So I found out that ucwords() should fix it but I got syntax when I tested
echo $fmt->ucwords(format(new \DateTime($w_date)));
Where and how should I place the ucwords() ? Thanks.
Solution
ucwords
should surround the whole command, since format
is a function of $fmt
, while ucwords
is a function by itself.
echo ucwords($fmt->format(new \DateTime($w_date)));
Answered By - aynber Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.