I have an SDK which returns the time in yyyy-mm-dd't'hh:mm:ssZ
this format, but I just want the Day, Month and Time.
I searched it over and didn't found an exact solution to my problem. Can anyone help?
I have an SDK which returns the time in yyyy-mm-dd't'hh:mm:ssZ
this format, but I just want the Day, Month and Time.
I searched it over and didn't found an exact solution to my problem. Can anyone help?
You can use moment for sure but you can use Date API to achieve it. The format you have mentioned it's ISO string. You can pass it directly to JavaScript Date method and use it in following way:
const formated_Date = '2017-07-30T15:01:13Z';
const date = new Date(formated_Date) // formated_Date - SDK returned date
console.log(`${date.getDate()}, ${date.getMonth() +1 }, ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`)
This will return you Date, Month, HH:MM:SS
Easy enough using momentjs, it already understands the ISO8601 formats for time and date strings.
let str = '2018-07-30T15:01:13Z';
let date = moment(str);
console.log(date.format('llll'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.1/moment.min.js"></script>
Take a look at the docs and you can format it however you need.