/// <summary>
/// object转化为json时Datetime类型格式转化
/// </summary>
/// <returns></returns>
private static IsoDateTimeConverter SetJsonDateTimeFormate()
{
IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm";
return timeConverter;
}
//将object转化成json格式
private string GetConvertEntityJson(string id) { string json = ""; BPileinfo bllPileinfo = new BPileinfo(); MES_YD_PILEINFO pileInfo = bllPileinfo.GetPileinfoInfo(id); json = JsonConvert.SerializeObject(pileInfo,SetJsonDateTimeFormate()); return json; }
原文链接:/json/290598.html