So I discovered the wonders of DateTime and DateTimeZone but must have overlooked one critical problem - I cannot see how to use the current locale to format a timestamp!
For example, today I would like to say its “Mars” (french), not “March”.
How can I do that with these classes?
As far as I know PHP’s DateTime object only supports English.
It’s unfortunate that it feels like a lot of these new objects we have are taking a step backwards (or at least, not forwards) in many aspects
If you are in windows then there are different strings for setting setlocale. Like following does works:
setlocale(LC_ALL, 'french'); echo strftime("%A %B"); // prints mardi mars
You will find windows setlocale strings as follows: