Park meter solution

jorgearandaf

New Member
Hi there I been working with a park meter solution and although the result is right I want to format this to time so that we can give as a result the price tag for the time spent on the parking lot. As far as I can get is this

$date = strtotime ('{parking_timer___salida_timer}');
$date1 = strtotime ('{parking_timer___date_time}');
$date_diff = ($date - $date1);
return $date_diff;

But I tried to format the result as time and as far as now I can not format the result.

I try this, but no change has come as I expected

$time_diff = sprintf("%04d-%02d-%02d-%02h-%02m-%02s", $year, $month, $day, $hour, $min, $sec);

Thanks for the quick response, and of course friendly bump. ;D
 
So is your $date_diff calculation returning the correct number of seconds?

If so, and the time is always going to be less than one day, you could just do:

PHP:
return gmdate('H:i:s', $date_diff);

If your time is going to be more than 24 hours, you'll have to use one of the various techniques you can find by googling "php format seconds as time" or some similar set of search terms.

-- hugh
 
Thanks a lot, your answer works just fine.

To conclude the time calculation, now I need that by each 15 minutes of time spent, then the result be presented on a final element (calc).

parking_timer___costo_timer

if 15 minutes cost $4.00 then 44 minutes $12.00 and the most I can charge per day is $80.00 without exceeding this price per day, how can I get this.

As always thanks in advance and another friendly bump ;D
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top