如何在php找到最近的一天? [英] How to find nearest day of week in php?

查看:139
本文介绍了如何在php找到最近的一天?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果最初我有一个日期字符串,那么如何在PHP中找到最近几天的定义。 07.05.2010 ?例如,我想找到最近的星期天(或一周的任何一天)。我该如何实现?谢谢

How to find a speciefic nearest day of the week in PHP if initially I have a date string like: 07.05.2010? For example, I want to find the nearest Sunday (or any day of the week). How can I implement this? Thanks

推荐答案

应该这样做:

echo date('d.m.Y', strtotime('next Sunday', strtotime('07.05.2010')));

这篇关于如何在php找到最近的一天?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆