I have a Date that looks like 2019-07-22T20:58:22
. This is the format I get back from our backend.
How can I convert it to Jul-22 20:58 ? I do not need any other info like years and month has to be in that three letters format.
I have a Date that looks like 2019-07-22T20:58:22
. This is the format I get back from our backend.
How can I convert it to Jul-22 20:58 ? I do not need any other info like years and month has to be in that three letters format.
You can try this:
import moment from 'moment';
const yourDate = '2019-07-22T20:58:22';
const formattedDate = moment(yourDate).format('MMM-DD HH:mm');
console.log(formattedDate); // "Jul-22 20:58"
Hope this help :)
That is an iso 8601 format. You may use the moment library to parse your date to any format you need.
Please note this also looks like a duplicate to the following. see link for an excellent overview of your issue