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

前端 未结 8 1803
南笙
南笙 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 12:01

    $dtShowDate = $_POST['dtShowDate']; $date =explode('-', $dtShowDate)0; $showdate = $date[2]."-".$date[0]."-".$date[1];

    Set Date as per your need

    0 讨论(0)
  • 2020-11-29 12:04

    This mysql function will return the correct format in the result

    SELECT DATE_FORMAT(date_field, "%M %d %Y");
    
    0 讨论(0)
提交回复
热议问题