Mysql
 SQL >> Database >  >> RDS >> Mysql

Formattare una data proveniente da MySQL in PHP

Puoi usare strtotime per convertire la stringa della data in un timestamp, poi date per formattare quel timestamp come preferisci:

$timestamp = strtotime($frmdate); $formatted_date = date("j M. Y", $timestamp); 

Puoi anche spostare la conversione da yyyy-mm-dd a timestamp direttamente nella query:

select unix_timestamp(field_name) as field_name_timestamp