Convert it to a date format that postgres uses before saving to the db. d.m.Y isn't a valid format for postgres. https://www.postgresql.org/docs/9.1/datatype-datetime.html#DATATYPE-DATETIME-DATE-TABLE
Apr 18, 2019
5
Level 3
Problem with german date format
Hello,
i have problems with german date format and postgresql.
this is part of json request to the API: trainingsdate: "21.02.2019"
Validation in the controller:
$this->validate($request, [
'art' => 'required|max:1|min:1',
'trainingsdate' => 'required|unique:trainings|date|date_format:d.m.Y'
]);
and save the data to the database:
$training = new Training([
'trainingsdate' => $request->get('trainingsdate'),
'art' => $request->get('art'),
]);
$training->save();
I've got an error:
SQLSTATE[22008]: Datetime field overflow: 7 ERROR: date/time field value out of range: "21.02.2019"
My timezone is set it to Europe/Zurich How can i use the german date format (dd.mm.yyyy) in lumen?
Please or to participate in this conversation.