Since PHP uses data from ICU in the intl extension, are there ways to get localized month names from within PHP?
While I can get the data from ICU's xml files and extract them into my own set of files, I would much prefer a clean and easier solution if possible.
Finally, are there ways to get the date format (MM/DD/YYYY or DD/MM/YYYY), given the locale from the intl extension?
(This is not a real answer, it would be a comment to Steven R. Loomis' answer. I write it only because I can't format code in comments)
Thank you Steven R. Loomis, this is my solution:
Could you use
IntlDateFormatter::getPattern
to get the pattern? I don't know about strftime, but I would use the suggestion of formatting with a patternMMMM
to get the month name, through each month. Looks like php.intl doesn't expose the data directly.Not sure what you need the month names for, but if you just want to use translated names for months,
strftime()
uses the names according to the current locale (use the%B
modifier).If you want a list of month names for some other use you can use
strftime()
for that too:For the second question there might be a native function for it but it's not hard to make one yourself:
and so on