Problems when displaying date in appropriate format

Asked

Viewed 24 times

0

I have this date:

<?php echo date("d/M/Y", strtotime($registro['DATA_VENCIMENTO'])); ?>

is showing off like this: 15/Oct/2019

How do I display in English, without losing the formatting I put (d/M/Y)?

I want to show off like this: 15/10/2019

  • tries with setlocale (LC_ALL, 'pt_BR');

  • Take a look here: https://answall.com/questions/8317/como-fazer-a-fun%C3%A7%C3%A3o-date-format-a-data-in-Portuguese%C3%Aas

  • They explain how to do but it gets date in full, I cannot lose formatting

  • 1

    Ah, you changed the question... instead of d/M/Y, do d/m/Y, with the m lowercase. It has all possible formatting in the documentation: http://php.net/manual/en/function.date.php

  • Thank you! Anderson

1 answer

1


In accordance with the documentation, the formatting M is a representation textual short of the month name (three letters); on the other hand, the formatting m is the representation numerical of the month, with zero left.

So just change M for m:

echo date("d/m/Y", strtotime($registro['DATA_VENCIMENTO']));

Browser other questions tagged

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