Site Tools


Hotfix release available: 2025-05-14b "Librarian". upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian". upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian". upgrade now! [56] (what's this?)
prog:php:functions:date_diff
/**
* example: date_diff("2007-04-29", "2007-05-01") -> 2
*/
function date_diff($start, $end)
{
        $s1 = split("-", $start);
        $s2 = split("-", $end);
        $x1 = gregoriantojd($s1[1], $s1[2], $s1[0]);
        $x2 = gregoriantojd($s2[1], $s2[2], $s2[0]);
 
        return $x2 - $x1;
}
prog/php/functions/date_diff.txt · Last modified: 2019/09/20 15:52 by 127.0.0.1