mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 21:24:58 +00:00
Extension for DateTime.ToShortTimeString() missing in NetStandard
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace ICD.Common.Utils.Extensions
|
namespace ICD.Common.Utils.Extensions
|
||||||
{
|
{
|
||||||
@@ -7,6 +8,16 @@ namespace ICD.Common.Utils.Extensions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class DateTimeExtensions
|
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>
|
/// <summary>
|
||||||
/// Gets a string representation of the DateTime with millisecond precision.
|
/// Gets a string representation of the DateTime with millisecond precision.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user