Silver Stripe Data

Asked

Viewed 15 times

-1

How to put date in format d-m-Y with these fields?

private static $summary_fields = array(
  'Created',
  'LastEdited',
);

private static $field_labels = array(
  'Created' => 'Criado',
  'LastEdited' => 'Logado',
);

1 answer

0

A simple way to do in PHP, assuming the date is a string, would be:

function formataData($data)
{  
    $t = strtotime($data);
    return date('d/m/Y ', $t);
}

//entrada: '2020-07-07'
//saida: '07/07/2020'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.