在PHP上获得这个周末? [英] Get this weekend in php?

查看:96
本文介绍了在PHP上获得这个周末?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在php上获得这个周末。

I'm trying to get this weekend in php.

我通过代码获取当前日期:

I get the current date by code :

$start_date = date("Y-m-d H:i:s", time());

我可以如何获得当前周末取决于固定日期?谢谢!

How I can get the current weekend depend on the curent date? Thank you!

推荐答案

PHP strtotime 功能是魔术,大多数人不知道,但你可以用这个功能做很多事情。

PHP strtotime function is magic, most of people don't know but you can do a lot of things with this function.

$start_date = date("Y-m-d H:i:s", strtotime('next Saturday'));

这篇关于在PHP上获得这个周末?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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