Issue
I wrote the code like below and show like photo.
but
I want to show only "hour and minutes" like
14:56
Is it possible to display only hours and minutes like this? If it is possible, how can I show it?
Json
{
"time_start": "2022-12-22 14:56:00",
"time_end": "2022-12-22 16:56:00",
}
React.js
{schedules.map(schedule => (
<div className="each_scheduled" key={schedule.id}>
<div>
<p className="scheduled_p">Time</p>
<p className="scheduled_p">{schedule.time_start} - {schedule.time_end}</p>
</div>
</div>
))}
Solution
You can use slice.
let time_start = "2022-12-22 14:56:00"
console.log(time_start.slice(11,-3))
//Output: 14:56
Answered By - Adrien Masson
Answer Checked By - - Gilberto Lyons (ReactFix Admin)