duande1985 2019-05-07 08:01
浏览 88

PHP Laravel Dusk使用美国日期时间格式

In my site, there's a form with a datetime. When I open the site, the datetime format is this:

wanted datetime format

Notice the last two dashes. These are for AM or PM, not used in the European date format.

However Laravel Dusk shows this field this way:

datetime format Laravel Dusk

Filling in the form thus fails, because the American datetime format is used where the European datetime format should be used. I have tried a datetime converter, which didn't work.

Is there any way to configure Laravel Dusk to see datetime fields in the European fashion?

  • 写回答

2条回答 默认 最新

  • dtjw6660 2019-05-07 08:14
    关注

    What ever the date format is coming but if you wan to change the date format as your desired date format then you can try following solution,

    function convertDateFormat ($date) 
    { 
        // convert date and time to seconds 
        $sec = strtotime($date); 
    
        // convert seconds into a specific format 
        $date = date("Y-m-d H:i", $sec); 
    
        // append seconds to the date and time 
        $date = $date . ":00"; 
    
        // print final date and time 
        echo $date; 
    } 
    
    // Driver code 
    $date = "01/01/2019 10:00 AM"; 
    convertDateFormat ($date); 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入