mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
feat: Add method to IcdEnvironment to get the name of the local time zone
This commit is contained in:
parent
456a8f74f9
commit
4ff4e9f3c6
2 changed files with 20 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue