首先感謝您抽出寶貴時間來研究這個問題。在發送json之前轉換unix時間戳
我存儲的日期在我的數據庫爲unix時間戳,當我開始使用的所有信息:
while($row = mysql_fetch_assoc($result)) {
$posts[] = $row;
}
/* return the posts in the JSON format */
return json_encode($posts);
的日期只能作爲一個Unix時間戳,當我試圖讓使用下面的吧:
var postHandler = function(postsJSON) {
$.each(postsJSON,function(i,post) {
alert(post.date);
}
}
有沒有辦法將它轉換爲可讀日期,然後再通過JSON發送它?甚至之後呢?
非常感謝你的幫助。
沒有答案解決您的問題? – dragon 2012-04-10 00:53:29