Hello! Dear community, please tell me, maybe someone has already encountered this problem:
I get the line trace. view:
"Ноябрь 20 2012" "Декабрь 19 2012" "Сентябрь 12 2012" "Июнь 5 2012" "Август 2 2012"
You must submit these lines in the next. format:
11.20.2012 12.19.2012 09.12.2012 06.05.2012 08.02.2012
Of course there is no problem to get the year and date, but what about the month?
I found a function that parses the date, but of course with the bummer month:
$date = "Ноябрь 20 2012"; print_r(date_parse_from_format("F j Y", $date));
Help please advice how to be with the month!
IN ADDITION to the answer @ Indifferent :
function newFormatDate($date) { $date = str_replace( array('Январь', 'Фервраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'), array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), $date); return date("dmY", strtotime($date)); } foreach($html->find('div.narrow_column div div.postdate') as $element) { $dateNews = $element->innertext; $date = $dateNews; $date = newFormatDate($dateNews); $array_dateNews[] = $date; }