Answers for "different date in php"

PHP
2

php get date between two dates

$period = new DatePeriod(
     new DateTime('2010-10-01'),
     new DateInterval('P1D'),
     new DateTime('2010-10-05')
);

//Which should get you an array with DateTime objects. 

//To iterate

foreach ($period as $key => $value) {
    //$value->format('Y-m-d')       
}
Posted by: Guest on August-22-2020
0

whats the difference between using date function and DATETime in php

function weeknumber($ddate) {
    $date = new DateTime($ddate);

    return $date->format('W');
}
Posted by: Guest on February-05-2021

Code answers related to "different date in php"

Browse Popular Code Answers by Language