lampac/Shared/Engine/Utilities/TimeZoneTo.cs
lampac-talks f843f04fd4 chore: initial commit 154.3
Signed-off-by: lampac-talks <lampac-talks@users.noreply.github.com>
2026-01-30 16:23:09 +03:00

36 lines
837 B
C#

namespace Shared.Engine
{
public static class TimeZoneTo
{
public static bool ByIds(string[] zones, out DateTime zoneTime)
{
zoneTime = DateTime.MinValue;
foreach (var zone in zones)
{
if (ById(zone, out zoneTime))
return true;
}
return false;
}
public static bool ById(string zone, out DateTime zoneTime)
{
zoneTime = DateTime.MinValue;
try
{
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Europe/Kiev");
zoneTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tz);
return true;
}
catch
{
return false;
}
}
}
}