date( ) returns 1970-01-01

后端 未结 4 403
醉梦人生
醉梦人生 2021-01-14 16:37

I am using a jquery datepicker with the following format mm/dd/yyyy but I need it to be yyyy-mm-dd for the sql db so I am using this.

   $date  = date(\"Y-m-         


        
4条回答
  •  鱼传尺愫
    2021-01-14 16:59

    put dateformat in jquery when initializing the datepicker like

    $( "#id/.class" ).datepicker({dateFormat: 'yy-mm-dd'}); 
    

    This format will insert on mysql db(done on client side), otherwise format it on the server side code.

提交回复
热议问题