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++;
}
Comments
Post a Comment