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

前端 未结 8 1885
南笙
南笙 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:51

    You can display you date in any format you want in your pages, in mysql i realy don't know, in php you can use this function: date ( string $format [, int $timestamp ] ). So you can do this:

    echo date( "d/m/Y", strtotime ( $your_date ) );

    You can find full description here: http://php.net/manual/en/function.date.php

提交回复
热议问题