I have a date in MySQL format and I want to display the date localized into my user county date format.
I would like to know if there is a way to get the format by a country's ISO code, something like:
$mysql_date = '2017-12-31';
echo print_localized_date($mysql_date,'it'); // 31/12/2017
echo print_localized_date($mysql_date,'de'); // 31.12.2017
echo print_localized_date($mysql_date,'us'); // 12/31/2017
I know I could directly pass the format but our site potentially sells all over the world and I should consider every date format.
Another solutions could be storing into my country table a column with the PHP date format string, in that case is there a resource from which I could get that information, hopefully a CSV or a SQL dump?
I use Laravel and Carbon but I don't see a solution in that library, for instance moment.j
has exactly what I'm looking for: ["moment.js Multiple Locale Support][1]
but in JavaScript, I need it in PHP.