tbr*_*mer 7 javascript api date instagram
这是我的Web应用程序的一个脏JSFiddle版本,但是,我不明白如何从Unix TimeStamp正确调整日期,我想要显示的是月,日和年.
任何帮助将不胜感激!
这是代码:
$(function() {
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: "https://api.instagram.com/v1/tags/crookedspaces/media/recent/?access_token=16741082.1b07669.121a338d0cbe4ff6a5e04543158a4f82",
success: function(data) {
console.log(data);
//OKAY, now lets get to the pretty stuff, INSTAGRAM PEEKTARS.
for (var i = 0; i < 5; i++) {
$(".instagram").append("\
<div class='instagram-feed'>\
<img class='instagram-image' src='" + data.data[i].images.standard_resolution.url +"' width='325px'/>\
<div class='igHover2'>\
posted by: "+data.data[i].user.username+"<br />\
posted on: "+Date(data.data[i].created_time).toString()+"<br />\
</div />\
</div>\
");
}
}
});
});?
Run Code Online (Sandbox Code Playgroud)
Igo*_*tin 14
这个给你:
$(function() {
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: "https://api.instagram.com/v1/tags/crookedspaces/media/recent/?access_token=16741082.1b07669.121a338d0cbe4ff6a5e04543158a4f82",
success: function(data) {
console.log(data);
//OKAY, now lets get to the pretty stuff, INSTAGRAM PEEKTARS.
for (var i = 0; i < 5; i++) {
var date = new Date(parseInt(data.data[i].created_time) * 1000);
$(".instagram").append("\
<div class='instagram-feed'>\
<img class='instagram-image' src='" + data.data[i].images.standard_resolution.url +"' width='325px'/>\
<div class='igHover2'>\
posted by: "+data.data[i].user.username+"<br />\
posted on: "+(date.getMonth()+1)+"/"+date.getDate()+"/"+date.getFullYear()+"<br />\
</div />\
</div>\
");
date = null;
}
}
});
});
Run Code Online (Sandbox Code Playgroud)
这个有效的http://jsfiddle.net/89YCe/2/现场演示
| 归档时间: |
|
| 查看次数: |
10808 次 |
| 最近记录: |