Hello to all! In PHP 5.3, there was a certain date_diff() function. Does hosting 5.2 have an alternative to date_diff() ?
1 answer
The question was addressed on stackoverflow: Undefined date_diff () .
example :
<?php function date_diff($date1, $date2) { $current = $date1; $datetime2 = date_create($date2); $count = 0; while(date_create($current) < $datetime2){ $current = gmdate("Ymd", strtotime("+1 day", strtotime($current))); $count++; } return $count; } echo (date_diff('2010-3-9', '2011-4-10')." days <br \>"); ?> |