mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +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
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the local time zone.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetLocalTimeZoneName()
|
||||
{
|
||||
return CrestronEnvironment.GetTimeZone().Name;
|
||||
}
|
||||
|
||||
public static DateTime GetLocalTime()
|
||||
{
|
||||
return CrestronEnvironment.GetLocalTime();
|
||||
|
||||
@@ -93,6 +93,17 @@ namespace ICD.Common.Utils
|
||||
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()
|
||||
{
|
||||
return DateTime.Now;
|
||||
|
||||
Reference in New Issue
Block a user