-1

Time format i have is 2022-02-16T12:33:44Z

How can is make this

2022-02-16

12:33 

including br tag.

what i tried was date.split("T") but don't know what to do next

Yoon Zoy
  • 45
  • 5
  • 1
    You can try [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat) – Hassan Imam Feb 16 '22 at 14:06
  • You can easily achieve the desired behavior through simple [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) methods. Also, React has nothing to do with this, it's just plain old JavaScript. – M0nst3R Feb 16 '22 at 14:31

1 Answers1

0
const str = "2022-02-16T12:33:44Z"
str.split("T")[0]
str.split("T")[1].slice(0,-4)

Output

2022-02-16

12:33

Harsh Mangalam
  • 1,116
  • 1
  • 10
  • 19