mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 20:17:15 +00:00
Extension for DateTime.ToShortTimeString() missing in NetStandard
This commit is contained in:
parent
9e9f1cadf1
commit
4de0dcafed
1 changed files with 11 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace ICD.Common.Utils.Extensions
|
||||
{
|
||||
|
|
@ -7,6 +8,16 @@ namespace ICD.Common.Utils.Extensions
|
|||
/// </summary>
|
||||
public static class DateTimeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Replacement for missing DateTime.ToShortTimeString() absent from NetStandard.
|
||||
/// </summary>
|
||||
/// <param name="extends"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToShortTimeString(this DateTime extends)
|
||||
{
|
||||
return extends.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a string representation of the DateTime with millisecond precision.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue