Reputation: 1
I want to create a widget in WP showing "today date" + 1 to 3 days.
For delivery of products, it would show like this : Delivery time expected between date+1day and date+3days.
I would insert code in html widget.
Here is what I tried :
<?php $i=1;echo $date = strtotime(date("d-m-Y", strtotime($date)) . " +".$i."days"); ?>
But it doesnt show anything... maybe edit functions.php.
OK am bad.
Upvotes: 0
Views: 1454
Reputation: 25412
If you are using PHP to do this, you're almost there:
$oneDay = date("d-m-Y", strtotime("+1 day"));
$threeDays = date("d-m-Y", strtotime("+3 days"));
So to echo it out:
echo "Delivery time expected between $oneDay and $threeDays.";
Remember that strtotime()
returns a UNIX timestamp (like 130000485), while date()
formats the timestamp using the string you provide, e.g. "d-m-Y" (like 04-02-2014 for today).
Upvotes: 1