mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 05:05:05 +00:00
feat: Add method to IcdEnvironment to get the name of the local time zone
This commit is contained in:
@@ -210,6 +210,15 @@ namespace ICD.Common.Utils
|
|||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name of the local time zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetLocalTimeZoneName()
|
||||||
|
{
|
||||||
|
return CrestronEnvironment.GetTimeZone().Name;
|
||||||
|
}
|
||||||
|
|
||||||
public static DateTime GetLocalTime()
|
public static DateTime GetLocalTime()
|
||||||
{
|
{
|
||||||
return CrestronEnvironment.GetLocalTime();
|
return CrestronEnvironment.GetLocalTime();
|
||||||
|
|||||||
@@ -93,6 +93,17 @@ namespace ICD.Common.Utils
|
|||||||
s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Na;
|
s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Na;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name of the local time zone.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetLocalTimeZoneName()
|
||||||
|
{
|
||||||
|
return System.TimeZoneInfo.Local.IsDaylightSavingTime(GetLocalTime())
|
||||||
|
? System.TimeZoneInfo.Local.DaylightName
|
||||||
|
: System.TimeZoneInfo.Local.StandardName;
|
||||||
|
}
|
||||||
|
|
||||||
public static DateTime GetLocalTime()
|
public static DateTime GetLocalTime()
|
||||||
{
|
{
|
||||||
return DateTime.Now;
|
return DateTime.Now;
|
||||||
|
|||||||
Reference in New Issue
Block a user