I am extracting from an API various data of a person and I need to format a date.
When making the API call to get the date
vm.preconcedido.datosPersona.datosPersonales.fechaNacimiento
The date appears to me like this 1961-05-29T00:00:00.000+0100
I have tried to format with the
.format(DD/mm/AAAA);
and it does not format the date correctly.
How could I format that date correctly?
Thank you very much, greetings
Natively it has the date
AngularJS
filter , in which you only have to specify the desired format. Now, if you only want to use the native form of you will have to get day , month (to this you must add 1, since January counts as month 0) and year separately and concatenate them in a variable; and lastly if you use momentjs just specify the format with the .Javascript
format('formatoDeseado')
I leave you the examples
A faster way to convert is to use native JavaScript functions;
Or directly with the binding {{}}, you could do the following:
I leave you an example: https://www.w3schools.com/code/tryit.asp?filename=FV2M84LNHNYJ
Also in your main module you can place the following configuration: