获取相对于其他日期的strtotime('last monday')


Getting strtotime('last monday') relative to some other date

我要做的是计算上周一的时间戳,但相对于其他日期。假设我给出了日期16-11-2011,我想要得到日期14-11-2011。

有没有办法做到这一点,而不硬编码?

使用strtotime的第二个参数设置"现在"时间,用于计算相对日期:

strtotime('last monday', strtotime($old_date));