public class CalendarController : ApiController
{
Events[] events = new Events[]
{
new Events { title= "event1", start = System.DateTime.UtcNow, end = System.DateTime.UtcNow },
new Events { title= "event2", start = System.DateTime.UtcNow, end = System.DateTime.UtcNow },
new Events { title= "event3", start = System.DateTime.UtcNow, end = System.DateTime.UtcNow}
};
public IEnumerable<Events> GetAllCalendar()
{
return events;
}
上記の JSON の結果は次のとおりです。
[{
"title": "event1",
"start": "2012-12-05T22:52:35.6471712Z",
"end": "2012-12-05T22:52:35.6471712Z"
},{
"title": "event2",
"start": "2012-12-05T22:52:35.6471712Z",
"end": "2012-12-05T22:52:35.6471712Z"
},{
"title": "event3",
"start": "2012-12-05T22:52:35.6471712Z",
"end": "2012-12-05T22:52:35.6471712Z"
}]
- 二重引用符なしで一重引用符を使用して同じ JSON 結果を作成する方法。
- 「YYYY-MM-DD HH:MM:SS」の形式で日付を取得する方法 ありがとう、スミス