Hello Peeps
Not sure how to resolve -hours on my date format.
I have a function which will tell me how many hours old an item is. This function is working fine but I need to apply some if statememts to it for sums. ie.
if ( $datediff <= -24 ){ // less than 24 hours old
$cost = $cost + 1;
$template->set_var('COST', $cost);
}
if ( ($datediff >= -25) && ($datediff <= -96) ){ // between 24 - 86 hours old (2 - 4 days)
$cost = $cost + 0.50;
$template->set_var('COST', $cost);
}
if ( ($datediff >= -97) && ($datediff <= -240) ){ // over between old (5 - 10 days)
$cost = $cost - 0.50;
$template->set_var('COST', $cost);
}
if ( $datediff >= -241 ){ // over 10 Days old
$cost = $cost - 1.00;
$template->set_var('COST', $cost);
}
But being that my date function returns -xx figures the above will not work corectly. If I put them to <= then all would be the last if statement.
Also my starting price is
$cost = 4.00;
But only shows up 4 or 5 or xx.5 never shoing 2 decimal places. How can I get it to show this.
Hope you can help
Regards
Lee