Change date format (in DB or output) to dd/mm/yyyy - PHP MySQL

前端 未结 8 1912
南笙
南笙 2020-11-29 11:18

MySQL stores the date in my database (by default) as \'YYYY-MM-DD\' The field type for my date is \'DATE\' (I do not need any time storage).. Is there a simple way to change

8条回答
  •  醉酒成梦
    2020-11-29 11:43

    i'm using this script and put it on upper line.

    $(function(){
        var pickerOpts = {
            dateFormat: "yy-mm-dd"
        };  
        $("#datepicker").datepicker(pickerOpts);
    });
    

    and this one in your form.

    
    

    It will appear as d/m/y on your page but in your database y/m/d.

提交回复
热议问题