i keep getting this error on the car_detail.php page on my database
Warning: date() expects parameter 2 to be long, string given in /home/speedycm/public_html/speedyautos/cars_class.php on line 228*
cars_class.php reads this on line 228
$this->expiry_date = date("m/d/Y", $rows['expiry_date']);
how can i resolve this?
date() expects a unix timestamp... I imagine you are passing it a date as a string.
e.g. 2010-10-10
You should use:
$this->expiry_date = date("m/d/Y", strtotime($rows['expiry_date']));
Or better yet, use the DateTime object.
$expiry_date = new DateTime($rows['expiry_date']);
$this->expiry_date = $expiry_date->format('m/d/Y');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With