最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Angularjs: timestamp to formatted UTC time with date helper - Stack Overflow

programmeradmin3浏览0评论

I'm looking for idea how to format unix timestamp with AngularJS date helper?

In official documentation, there is only explanation for string inputs (If no timezone is specified in the string input, the time is considered to be in the local timezone), but what about timestamp? Any hint?

I'm looking for idea how to format unix timestamp with AngularJS date helper?

In official documentation, there is only explanation for string inputs (If no timezone is specified in the string input, the time is considered to be in the local timezone), but what about timestamp? Any hint?

Share Improve this question edited Feb 13, 2014 at 16:42 Paul Sweatte 24.6k7 gold badges131 silver badges268 bronze badges asked Dec 9, 2013 at 12:01 sasasasa 2,4436 gold badges23 silver badges35 bronze badges 1
  • suggest you add specific examples of input / output. Docs aren't specific about string inputs, will accept any valid input that javascript new Date() accepts – charlietfl Commented Dec 9, 2013 at 13:47
Add a ment  | 

1 Answer 1

Reset to default 6

I've found some solution with custom filter and momentjs library:

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

评论列表(0)

  1. 暂无评论