diff --git a/CHANGELOG.md b/CHANGELOG.md index dfbe750..d7094d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Added a method for converting 24 hour to 12 hour format + - Added a method for determining if a culture uses 24 hour format ## [9.8.0] - 2019-09-03 ### Added diff --git a/ICD.Common.Utils/Extensions/CultureInfoExtensions.cs b/ICD.Common.Utils/Extensions/CultureInfoExtensions.cs new file mode 100644 index 0000000..4199c54 --- /dev/null +++ b/ICD.Common.Utils/Extensions/CultureInfoExtensions.cs @@ -0,0 +1,17 @@ +using System.Globalization; + +namespace ICD.Common.Utils.Extensions +{ + public static class CultureInfoExtensions + { + /// + /// Returns true if the given culture uses a 24 hour time format. + /// + /// + /// + public static bool Uses24HourFormat(this CultureInfo extends) + { + return extends.DateTimeFormat.ShortTimePattern.Contains("H"); + } + } +} diff --git a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj index ec7247f..9ec13c9 100644 --- a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj +++ b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj @@ -110,6 +110,7 @@ +