简体   繁体   English

获取接下来的 2 天,不包括 PHP 中的当前日期

[英]Get next 2 days not counting current day in PHP

I have an Unix timestamp like this 1660293621 (2022-08-12 8:40).我有一个 Unix 时间戳,例如 1660293621(2022-08-12 8:40)。 I want to get next 2 days not counting current date.我想得到接下来的 2 天,不包括当前日期。 I expect the result to be 2022-08-15 00:00.我预计结果是 2022-08-15 00:00。 I tried我试过了

strtotime("+3 Days", $current_date)

but it returns 2022-08-15 8:40, not 00:00但它返回 2022-08-15 8:40,而不是 00:00

How can I get that in PHP?我怎样才能在 PHP 中得到它? Thank you~谢谢~

$Today=date('y:m:d');

// add 3 days to date
$NewDate=Date('y:m:d', strtotime('+3 days'));

Reference: Increase days to php current Date()参考: 将天数增加到 php 当前日期()

I figured it out我想到了

strtotime("+3 days 0:00", $current_date);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM