显示日期从当前日期开始增加2天

时间:2017-05-16 07:51:32

标签: wordpress

我想创建一个短代码,通过从当前日期开始增加2天来显示日期。例如,如果今天是16月5日,我想通过短代码显示18。

请帮助我。

2 个答案:

答案 0 :(得分:0)

Hi PLease检查以下代码

<?php
$date = strtotime("+2 day");
echo date('M d, Y', $date);
?>

我希望这会对你有所帮助。

答案 1 :(得分:0)

<?php

    if( !function_exists( 'yourFunction' ) ) {
        function yourFunction(){
            return  date('d-M', strtotime("+2 days"));
        }
        add_shortcode( 'Youuniqueshortcode', 'yourFunction' );
    }
?>

希望这会对你有所帮助 如果没有让我知道:) 快乐编码

相关问题