如何添加[今天的日期+1天] [英] How to add [today's date +1 day]

查看:142
本文介绍了如何添加[今天的日期+1天]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前在wordpress中使用以下代码:

I'm currently using this code in wordpress:

// [date]  
function displaydate(){  
return date('l, F jS, Y');  
}  
add_shortcode('date', 'displaydate');  
// end date

-

我想做的是添加另一个短代码,该短代码将显示今天的日期+1天。

What I want to do is add another shortcode that would display todays date +1day.

所以我可以这样写:

'...优惠用完[今天的日期+1天]'

'...offer runs out [todays date +1day]'

有人知道该怎么做吗?

推荐答案

PHP中最简单的方法是使用 strtotime 函数。

The easiest way in PHP would be using the strtotime function.

对于您的代码,您应该添加:

As for your code you would add:

return date('l, F jS, Y', strtotime('+1 day'));

根据您的原始代码,一个名为明天的简码看起来像这样:

Based on your original code a 'shortcode' called 'tomorrow' would look like this:

// [tomorrow]  
function displaydate_tomorrow(){  
    return date('l, F jS, Y', strtotime('+1 day')); 
}  
add_shortcode('tomorrow', 'displaydate_tomorrow'); 
// end tomorrows date

这篇关于如何添加[今天的日期+1天]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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