mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 04:35:00 +00:00
feat: Added an extension method for getting the hour in 12 hour format
This commit is contained in:
@@ -10,6 +10,16 @@ namespace ICD.Common.Utils.Extensions
|
||||
/// </summary>
|
||||
public static class DateTimeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the hour in 12 hour format (1 through 12).
|
||||
/// </summary>
|
||||
/// <param name="extends"></param>
|
||||
/// <returns></returns>
|
||||
public static int Get12Hour(this DateTime extends)
|
||||
{
|
||||
return ((extends.Hour + 11) % 12) + 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replacement for missing DateTime.ToShortTimeString() absent from NetStandard.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user