2 years ago

Carbon timeformat

Posted 2 years ago by mturner20

I am using angular js to grab the time the user inputs into a form. And it returns weird like 2017-04-18T16:07:57Z. Now I am trying to use Carbon to put it in the right format of 16:07:57.

Here is my method of saving/posting the form

public function store(Request $request) {

    $event = new Event();
    $event->event_title = $request->input('event_title');
    $event->event_description = $request->input('event_description');
    $event->event_location = $request->input('event_location');
    $event->event_date = $request->input('event_date');

    $event->event_time = Carbon::now();

    //return response()->json(['event'=>$event, 'user'=>$user], 201);
    return 'Event record successfully created';

Please sign in or create an account to participate in this conversation.