gpt4 book ai didi

javascript - Angularjs:使用日期助手格式化 UTC 时间的时间戳

转载 作者:可可西里 更新时间:2023-11-01 02:09:56 26 4
gpt4 key购买 nike

我正在寻找如何使用 AngularJS 日期助手格式化 unix 时间戳的想法?

official documentation ,只有字符串输入的解释(如果字符串输入中没有指定时区,时间被认为是在本地时区),但是时间戳呢?有什么提示吗?

最佳答案

我找到了一些带有自定义过滤器和 momentjs 库的解决方案:

app.filter('moment', function() {  
return function(input, format) {
return moment(parseInt(input)).utc().format(format);
};
});

关于javascript - Angularjs:使用日期助手格式化 UTC 时间的时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20470139/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com