我有:
我想从中找到日期。如何在PHP中做到这一点?
示例:
$day = "wednesday";
$week = 1;
$year = 2019
getDate($day, $week, $year) // must return 2019-01-02
答案 0 :(得分:3)
尝试以下一个
$day = array(
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
);
$intday = array_search('Saturday', $day);
$gendate = new DateTime();
$gendate->setISODate(2019,1,$intday); //Year, week number, day
echo $gendate->format('d-m-Y');
希望这对您有帮助
答案 1 :(得分:2)
$year = 2018;
$weakNum = 50;
$dayNum = 3;
$date = new DateTime();
$date->setISODate($year,$weakNum,$dayNum);
echo $date->format('d.m.Y');
答案 2 :(得分:0)
尝试:
ChoiceFilter
答案 3 :(得分:-1)
尝试一下:
$weekNo = date("W", strtotime("2018-12-20"));