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 add re-captcha v3 on all Elementor forms using coding?

 Add re-captcha v3 on all Elementor forms using coding add_action('wp_footer',function(){     ?> <script src="https://www...