Answer the question
In order to leave comments, you need to log in
How to get day and month by converting variable in php?
echo $rusdate; // выведет ПТ 18:00 или СР 12:00 и тому подобное, по сути это текстовая строка
12 октября к 18:00
Answer the question
In order to leave comments, you need to log in
You can get the time of, say, Monday this week via relative time format strtotime('monday this week');
(English only)
$rusdate='ПТ 18:00';
list($dow, $hours, $minutes) = sscanf($rusdate, "%s %d:%d");
$rusweek = explode(',','ВС,ПН,ВТ,СР,ЧТ,ПТ,СБ');
$ndow = array_search($dow, $rusweek);
date_default_timezone_set('Europe/Moscow'); // если не настроен PHP
$time = strtotime('monday this week') + 86400 * $ndow + 3600 * $hours + 60 * $minutes;
echo date('Y-m-d H:i:s', $time);
// 2018-10-13 18:00:00
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question