I am using the fullCalendar plugin/directive in Angular, and I am currently having an issue when trying to save the date/time into my database.
These are the values being posted to my server:
{"title":"Hey","start":"2015-08-13T00:00:00.000Z","end":"2015-08-13T00:00:00.000Z","allDay":true}
Now in my controller I try to convert both date/time string into valid date/time format before saving into my database:
public function store(ScheduleRequest $request)
{
$schedule = new Schedules;
$schedule->allDay = $request->allDay;
$schedule->start = strtotime(date('Y-m-d H:i:s', $request->start));
$schedule->end = strtotime(date('Y-m-d H:i:s', $request->end));
$schedule->title = $request->title;
if ($schedule->save())
{
return [
'success' => 'Data Was Saved Successfully'
];
}
}
This is the error I get:
A non well formed numeric value encountered
I would like to know how to convert both datetime values into valid datetime objects in PHP using the specified format.