Scroll to top

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

How to get next 7 days from current date 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++;
}

Get more information

 

Read More Posts

Leave a Reply

Your email address will not be published. Required fields are marked *