admin 管理员组

文章数量: 1086019

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);  
    };  
});  

本文标签: javascriptAngularjs timestamp to formatted UTC time with date helperStack Overflow