---
title: "javascript格式化json日期格式"
author: "superfofo"
date: "2010-10-19T10:51:25Z"
tags: []
categories: ["Web前端"]
slug: "javascript-json"
draft: false
lastmod: "2010-10-19T10:51:25Z"
id: 788250
url: "https://superfofo.iteye.com/blog/788250"
---

通过java输出json对象后的日期格式如下所示：
{ "date" : 19, "day" : 2, "hours" : 9, "minutes" : 24, "month" : 9, "nanos" : 0, "seconds" : 36, "time" : 1287451476000, "timezoneOffset" : -480, "year" : 110 }

纠结了很长一段时间，最后偶尔发现，可以取出对象中time的属性，然后通过以下几步进行格式化：
<span style="color:red">var d = new Date(parseInt(t.time));</span>

d的格式类似:Tue Oct 19 09:24:36 UTC+0800 2010 
然后format以下d，将其输出到页面中去。