Javascript Moment js 将毫秒转换为日期和时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35184003/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 17:22:04 来源:igfitidea点击:
Moment js convert milliseconds into date and time
提问by Ajey
I have current time in milliseconds as - 1454521239279
我的当前时间以毫秒为单位 - 1454521239279
How do I convert it to 03 FEB 2016 and time as 11:10 PM ?
如何将其转换为 2016 年 2 月 3 日和晚上 11:10 的时间?
回答by Enver Dzhaparoff
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
时刻unix方法
moment.unix(1454521239279/1000).format("DD MMM YYYY hh:mm a")