I have a database field with a date as value, it is inserted by an API (which is hosted external) and gives the format yyyy-MM-ddT00:00:00. How can I convert this to a dd-MM-yyyy (no time) format when the value is recalled on the page? EG. 1964-05-11T00:00:00 has to be displayed as 11-05-1964
4 Answers
You could use this package: date-format.
You will be able to do something like that:
var format = require('date-format');
format('dd-MM-yyyy', new Date());
Hope this helps.
Comments
Better You can use js library
Source:
https://momentjs.com/
https://momentjs.com/docs/
Example(demo):
http://www.somelesson.blogspot.com/2016/06/momentjs-changing-locales-locally.html