Moment js convert milliseconds into date and time

2019-04-03 07:49发布

问题:

I have current time in milliseconds as - 1454521239279

How do I convert it to 03 FEB 2016 and time as 11:10 PM ?

回答1:

Moment parser

moment(1454521239279).format("DD MMM YYYY hh:mm a") //parse integer
moment("1454521239279", "x").format("DD MMM YYYY hh:mm a") //parse string

Moment unix method

moment.unix(1454521239279/1000).format("DD MMM YYYY hh:mm a")