How to format a date in Brazilian Javascript format?

Asked

Viewed 74 times

0

How do I format a date for the Brazilian standard in Javascript? I looked in several places but I could not get the date to be displayed in the Brazilian standard.

Summary of the problem:

  • How the date is in the database: 2021-02-05 04:30:25

  • How I wanted the date to be displayed in Return: 05/02/2021 04:30:25

The part of the code that I need to do this is down here, in case anyone understands better:

{
"render": function ( data, type, row ) {

    var dataCadastro = '2021-02-05 04:30:25'; // Formatar essa data para o padrão brasileiro > dd/mm/aaaa
    return dataCadastro; // retorna a data definida acima

    },
    "targets": 1,
},
  • For this and other features I recommend using lib Moment.js

  • My project has the built-in Moment.js, but I have no idea how using heheh could help me? <script src=".. /all/plugins/Moment/Moment.min.js"></script>

  • See if the answer helps.

No answers

Browser other questions tagged

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