I am currently writing the code with react.
I am displaying the data in json format that I received from axios.
I'd like to display this image until 2020-03-18, but I don't know how to display it because json's information itself includes time.I tried javascript getmonth, but it didn't show well, so could someone tell me?
<TableCell>Date</TableCell>
{
Payments.map(transaction,index)=>(
<TableCell> {transaction.CreatedAt}</TableCell>
}
Why don't you convert it to a Date instance and then string it to the format you want?
const date=new Date('2020-03-18T06:10:17Z');
console.log(`${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()}}`);//2020-3-18
© 2024 OneMinuteCode. All rights reserved.