【发布时间】:2015-09-04 05:52:43
【问题描述】:
我需要使用此处给出的 JSON 中的 created_at 并使用 angular,我只想打印日期。该怎么做?
files":{"65":[{"id":5,"ticket_id":65,"file_name":"1434545168_South Park s10e10 - Miss Teacher Bangs a Boy _ 480p UNCENSORED x264 NIT158.srt","file_size":"30893","file_url":"http:\/\/localhost\/levigo\/storage\/app\/1434545168_South Park s10e10 - Miss Teacher Bangs a Boy _ 480p UNCENSORED x264 NIT158.srt","**created_at":"2015-06-17 18:16:08"**},{"id":6,"ticket_id":65,"file_name":"1434545196_6croMg5xi.png","file_size":"65412","file_url":"http:\/\/localhost\/levigo\/storage\/app\/1434545196_6croMg5xi.png","created_at":"2015-06-17 18:16:36"},{"id":7,"ticket_id":65,"file_name":"1434545214_6croMg5xi.png","file_size":"65412","file_url":"http:\/\/localhost\/levigo\/storage\/app\/1434545214_6croMg5xi.png","created_at":"2015-06-17 18:16:54"}],"66":[]}
我已经通过制作过滤器来做到这一点,但它不起作用并且输出错误
myApp.filter('format', function () {
return function (item) {
var t = item.split(/[- :]/);
var d = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);
var time=d.getTime();
return time;
};
});
【问题讨论】:
-
过滤器给出什么输出?
标签: javascript json angularjs laravel