【问题标题】:Carbon Laravel textual month could not be found Unexpected data found找不到碳 Laravel 文本月份 发现意外数据
【发布时间】:2020-03-16 09:04:54
【问题描述】:

我在尝试使用此日期格式 Sunday 15th March 04:11 PM 时遇到问题:

Carbon::createFromIsoFormat('dddd Do MMMM hh:mm A')

但我得到了这个例外:

错误:找不到文本月份 发现意外数据。

我不确定我做错了什么。

【问题讨论】:

  • Carbon::createFromFormat("d M Y",strtotime('Sunday 15th March 04:11 PM'));
  • 你想这样格式化Sunday 15th March 04:11 PM 吗?还是什么?
  • 看来问题出在Do

标签: laravel php-carbon


【解决方案1】:

如果您需要使用该特定格式,可以像这样使用它

Carbon::rawCreateFromFormat('l jS F h:i A','Sunday 15th March 04:11 PM')

格式的含义参考PHP DATE

【讨论】:

  • 谢谢,没想到要用这个功能
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多