Hello friends
How to display a date and time from input like this 2013-02-08 09:30
or 2013/02/08 09:30
by using moment js in react js.
I am searching on www.moment.js but i didn’t find. Can anyone give me a suggestion or a solution?
Thanks
Isn’t it just YYYY-MM-DD HH:mm
did you look at the format part of the docs?
https://momentjs.com/docs/#/parsing/string-format/
2013-02-08 09:30 # An hour and minute time part
I got this description but i didn’t find it the format how to apply it.
For example if you see this:
moment().format('L');
It displays like this: 03/22/2020
Does L LT
, or L HH:mm
, do what you want?
I tested all but i couldn’t display what i want, i.e I want like this:
2013-02-08 09:30 or 2013/02/08 09:30
I want one of that you proposed but i need that to display in this format:
2013-02-08 09:30 or 2013/02/08 09:30
I’m confused, do these not do what you want?
console.log(moment().format('YYYY-MM-DD HH:mm'))
// 2020-03-22 21:58
console.log(moment().format('YYYY/MM/DD HH:mm'))
// 2020/03/22 21:58
@lasjorg finally it works.
Thanks