01 October 2019

How to get next 7 days from current day in php ?

Get next 7 days from current day in php 


global $wpdb;
global $wpsite;
$cd = date('d-m-Y');
$nd = date('d-m-Y', strtotime("$cd +".$oid." day"));
$begin = new DateTime($cd);
$end = new DateTime($nd);
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($begin, $interval, $end);
$i = 1;
foreach ($period as $dt) {
$dt->format("D d-m-Y");
$day = $dt->format("D");
$daynum = $dt->format("d");
echo '<div><span>'.$daynum.' '.$day.'</span></div>';
$i++;
}

No comments:

Post a Comment

How to create youtube videos slider with play and pause option in wordpress?

Create youtube videos slider with play and pause option in wordpress youtube videos slider Use this shortcode:- [punjab_today] function my_...