@@ -2,6 +2,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using SharpCompress.Writers;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Globalization;
|
||||
|
||||
namespace IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson
|
||||
{
|
||||
@@ -77,6 +79,37 @@ namespace IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson
|
||||
|
||||
return deserializedObj!;
|
||||
}
|
||||
|
||||
public static string DateTimeInternationalToString(DateTime? dateTime, string? clientZoneId=null)
|
||||
{
|
||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
||||
|
||||
if (dateTime.HasValue)
|
||||
{
|
||||
|
||||
var needDealTime = dateTime.Value;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(clientZoneId))
|
||||
{
|
||||
needDealTime = TimeZoneInfo.ConvertTime(needDealTime, TimeZoneInfo.Local, TimeZoneInfo.FindSystemTimeZoneById(clientZoneId));
|
||||
}
|
||||
|
||||
if (isEn_US)
|
||||
{
|
||||
//暂时保持一致,等需求确认,修改英文要展示的日期格式
|
||||
return needDealTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
else
|
||||
{
|
||||
return needDealTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user