Closed jperelli closed 9 years ago
Are you using Laravel on your example? If yes, date does automatically saved as far as I know. Also try using Carbon
instead.
$pac = new Pac();
$pac->some_date = Carbon::now();
$pac->save();
Was able to replicate the issue. To fix this, you should define the dates column on your model.
class Pac extends Eloquent {
protected $dates = ['some_date'];
}
Sorry I was unreachable without internet for some days.
Yes I am using Laravel, but I think that it would be nicer to support dates without using carbon, just with plain php Dates.
Nevertheless, thank you very much for the support and the tip of the date column definition on the model, I'll certainly use that!
Hi,
FYI: as of Laravel-OCI8 v2.1.6, PHP's DateTime object is now supported and does not require you to specify the date fields. But I still recommend using date fields for best practice.
Great! thanks
It would be nice that the oci8 driver would automatically convert a date object to an oracle's date string
I was trying to insert like this
And I was receiving this error
oci_bind_by_name(): Invalid variable used for bind
After some digging, I switched the second line into this and it worked ok.
$pac->some_date = date('dd-M-Y');
It would be nice if the data type is date, to convert it to string in oci_bind_by_name.