我有年,月,日和星期几。我想约会 例如:
$year = 2019;
$month = 8;
$week = 2; // second week of the month
$day = 2; // tuesday
$date = getDate($year, $month, $week, $day); // $date = '06/08/2019'
答案 0 :(得分:0)
您可以尝试使用PHP Relative Formats。
类似这样的东西
$date = new DateTime('first day of August 2019');
$date->modify('tuesday next week');
echo $date->format('Y-m-d');
它需要一点点从数字到字符串的转换,但是在需要处理相对日期时很有用。