我们如何将json返回日期更改为所需的输出日期格式?

时间:2016-06-24 05:06:58

标签: javascript jquery json ajax api

如何将Json返回日期更改为所需的输出日期格式? 嗨,我是api方面的新手。我在wordpress网站上使用api,我想将Json返回日期更改为所需的输出日期格式? 怎么可能? 请帮助,我将非常感谢你。

check this image link for idea enter image description here

2 个答案:

答案 0 :(得分:1)

var epochdate= 1234567890;  //assign your epoch date here
var date = new Date(0); // The 0 there is the key, which sets the date to the epoch
date.setUTCSeconds(utcSeconds);
document.getElementById("date").innerHTML = date;


<div id="date"><div>

日期现在是日期(在我的时区)设置为2009年2月13日星期五18:31:30 GMT-0500(EST)

答案 1 :(得分:0)

<div class="dateCnt">
<div class="dates">
<div class="dateWrap">
<div class="eventDate">{start}     // we use code on that place
var epochdate= 'DD-MM-YY';  //assign your epoch date here
var date = new Date({start}); // The 0 there is the key, which sets the date to the epoch
date.setUTCSeconds(utcSeconds);
document.getElementById("date").innerHTML = date;
</div>
</div>
</div>
</div>

需要帮助使用glistrr api.i想要更改日期格式。