[ create a new paste ] login | about

Link: http://codepad.org/MDQjsz5l    [ raw code | output | fork ]

PHP, pasted on Jul 30:
1
2
3
4
5
6
7
8
9
<?php
$total_days = 300;
$total_years = intval($total_days / 365);
$remaining_days = ($total_days % 365) % 30;
if ($total_days < 365) {
    $remaining_days = $total_days;
}
echo $total_years.' years and '.$remaining_days.' days';
?>


Output:
1
0 years and 300 days


Create a new paste based on this one


Comments: