1
我有JSON數據形式。 我想格式化日期等(d/M/Y)但是我有記錄以這種格式 > 「event_group_end」: 「2069-12-31T00:00:00Z」更改json數據的日期格式
HOW TO DO這是嗎?
Data= [
{
"country_group":null,
"country_id":null,
"created_at":"2013-07-02T14:43:28Z",
"event_country":"aut",
"event_group_city":"Innsbruck",
"event_group_end":"2069-12-31T00:00:00Z",
"event_group_start":"2069-12-31T00:00:00Z",
"event_group_title":"asdfasfsadf",
"event_location_id":null,
"id":11975,
"iso":null,
"status":0,
"updated_at":"2013-07-25T10:41:26Z",
"venue_id":"1027"
},
{
"country_group":null,
"country_id":null,
"created_at":"2013-07-02T14:43:26Z",
"event_country":"eng",
"event_group_city":"London",
"event_group_end":"2013-03-22T00:00:00Z",
"event_group_start":"2013-03-22T00:00:00Z",
"event_group_title":"jipj",
"event_location_id":null,
"id":11915,
"iso":null,
"status":0,
"updated_at":"2013-07-25T13:27:54Z",
"venue_id":"1264"
},
]
嗨@Mighty 感謝您的回覆。 我已經更新我的模型 'DEF start_date_display 自[:event_group_start] .strftime( 「%米/%d /%Y」) 端 DEF to_json 超級(:方法=> [:start_date_display]) 端' 當我做**放棄@ data.to_json ** DATEFORMAT沒有改變。 – Gagan
請檢查更新的答案 –