DateTime::format and strftime
I have $date = $run['at']; which gives me 2013-06-03T16:52:24Z (from a JSON input). To transform it to get for example " d M Y, H:i " I use $date = new DateTime($run['at']); echo $date->format('d M Y, H:i'); Problem is I need the date in italian. And the only function that supports set_locale is strftime . How can I "wrap" DateTime::format with strftime (or replace, dunno)? setlocale(LC_TIME, 'it_IT.UTF-8'); $date = new DateTime($run['at']); strftime("%d %B", $date->getTimestamp()) ... worked. :) I believe the "proper" way should be using DateTimeZone 来源: https://stackoverflow.com/questions