格式化时间

Uat_Study
he 2022-04-13 18:09:50 +08:00
parent 88117a84f7
commit e5edc33146
2 changed files with 9 additions and 2 deletions

View File

@ -2,6 +2,7 @@
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Contracts;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
@ -173,7 +174,9 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
{
if (auditInfo.JsonDetail.IsNullOrEmpty())
{
auditInfo.JsonDetail = JsonConvert.SerializeObject(OptCommand);
IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
timeFormat.DateTimeFormat = "yyyy-MM-dd";
auditInfo.JsonDetail = JsonConvert.SerializeObject(OptCommand, Newtonsoft.Json.Formatting.Indented, timeFormat);
}
return auditInfo;

View File

@ -5,6 +5,7 @@ using IRaCIS.Core.Application.Service.Inspection.Interface;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Panda.DynamicWebApi.Attributes;
using System;
@ -443,7 +444,10 @@ namespace IRaCIS.Core.Application.Service.Inspection
}
}
Data.JsonDetail = JsonConvert.SerializeObject(JsonData);
IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
timeFormat.DateTimeFormat = "yyyy-MM-dd";
Data.JsonDetail = JsonConvert.SerializeObject(JsonData, Newtonsoft.Json.Formatting.Indented, timeFormat);
}
catch (Exception)
{