PHP date showing '1970-01-01 ' after conversion

前端 未结 8 618
醉话见心
醉话见心 2020-12-04 16:44

I have a form in which date format is dd/mm/yyyy . For searching database , I hanverted the date format to yyyy-mm-dd . But when I echo

8条回答
  •  星月不相逢
    2020-12-04 17:30

    Another workaround:

    Convert datepicker dd/mm/yyyy to yyyy-mm-dd

    $startDate = trim($_POST['startDate']);
    $startDateArray = explode('/',$startDate);
    $mysqlStartDate = $startDateArray[2]."-".$startDateArray[1]."-".$startDateArray[0];
    $startDate = $mysqlStartDate;
    

提交回复
热议问题