如何在Laravel中通过Vuejs Datepicker格式化日期接收 [英] How to format date receiving through Vuejs Datepicker in laravel
本文介绍了如何在Laravel中通过Vuejs Datepicker格式化日期接收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在以Laravel
作为后端的Vuejs
中构建应用程序.我正在使用datepicker
在列中添加日期.我遇到了一个错误
I'm building an application in Vuejs
with Laravel
as backend. I'm using datepicker
to add dates in column. I'm getting an error of
无效的日期时间格式:1292错误的日期时间值:第1行的时间表"列的"2017-05-04T18:30:00.000Z"
Invalid datetime format: 1292 Incorrect datetime value: '2017-05-04T18:30:00.000Z' for column 'schedule' at row 1
我在请求中发送日期:
在laravel中做dd时,我得到了:
And while doing dd in laravel I'm getting:
有人可以指导我如何实现这一目标.
Can someone guide me how to achieve this.
推荐答案
您可以使用 Carbon
解析日期并相应地设置格式
You could use Carbon
to parse the date and format it accordingly
$mydate = '2017-05-04T18:30:00.000Z'; // $request->schedule
$parsed_date = Carbon\Carbon::parse($mydate)->toDateTimeString();
这篇关于如何在Laravel中通过Vuejs Datepicker格式化日期接收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文