增加ChartuseUtc参数设置显示时间是否用UTC时间

This commit is contained in:
monitor1394
2025-10-31 08:39:29 +08:00
parent 2cb82526bc
commit f1c9a3ac4b
12 changed files with 42 additions and 33 deletions

View File

@@ -100,9 +100,9 @@ namespace XCharts.Runtime
return NumberToStr(value, numericFormatter);
}
public static string NumberToDateStr(double timestamp, string formatter)
public static string NumberToDateStr(double timestamp, string formatter, bool local = false)
{
var dt = NumberToDateTime(timestamp);
var dt = NumberToDateTime(timestamp, local);
try
{
return dt.ToString(formatter, ci);
@@ -132,11 +132,11 @@ namespace XCharts.Runtime
}
}
public static DateTime NumberToDateTime(double timestamp)
public static DateTime NumberToDateTime(double timestamp, bool local = false)
{
if (!s_TimestampToDateTimeDict.ContainsKey(timestamp))
{
s_TimestampToDateTimeDict[timestamp] = DateTimeUtil.GetDateTime(timestamp);
s_TimestampToDateTimeDict[timestamp] = DateTimeUtil.GetDateTime(timestamp, local);
}
return s_TimestampToDateTimeDict[timestamp];
}