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 不正确的日期时间值:'2017-05-04T18:30:00.000Z' 列'schedule' 在第 1 行
Invalid datetime format: 1292 Incorrect datetime value: '2017-05-04T18:30:00.000Z' for column 'schedule' at row 1
我正在发送请求中的日期:
I'm sending the date in request:
在 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 = CarbonCarbon::parse($mydate)->toDateTimeString();
这篇关于如何在laravel中通过Vuejs Datepicker格式化接收日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在laravel中通过Vuejs Datepicker格式化接收日期
基础教程推荐
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
