Skip to main content
Version: 4.0 (next)

Humanizer.DateHumanizeExtensions

DateHumanizeExtensions Class​

Humanizes DateTime into human readable sentence

public static class DateHumanizeExtensions

Inheritance System.Object → DateHumanizeExtensions

Methods​

DateHumanizeExtensions.Humanize(this DateOnly, Nullable<DateOnly>, CultureInfo) Method​

Turns the current or provided date into a human readable sentence

public static string Humanize(this System.DateOnly input, System.Nullable<System.DateOnly> dateToCompareAgainst=null, System.Globalization.CultureInfo? culture=null);
Parameters​

input System.DateOnly

The date to be humanized

dateToCompareAgainst System.Nullable<System.DateOnly>

Date to compare the input against. If null, current date is used as base

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String
distance of time in words

DateHumanizeExtensions.Humanize(this DateTime, Nullable<bool>, Nullable<DateTime>, CultureInfo) Method​

Turns the current or provided date into a human readable sentence

public static string Humanize(this System.DateTime input, System.Nullable<bool> utcDate=null, System.Nullable<System.DateTime> dateToCompareAgainst=null, System.Globalization.CultureInfo? culture=null);
Parameters​

input System.DateTime

The date to be humanized

utcDate System.Nullable<System.Boolean>

Nullable boolean value indicating whether the date is in UTC or local. If null, current date is used with the same DateTimeKind of input

dateToCompareAgainst System.Nullable<System.DateTime>

Date to compare the input against. If null, current date is used as base

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String
distance of time in words

DateHumanizeExtensions.Humanize(this DateTimeOffset, Nullable<DateTimeOffset>, CultureInfo) Method​

Turns the current or provided date into a human readable sentence

public static string Humanize(this System.DateTimeOffset input, System.Nullable<System.DateTimeOffset> dateToCompareAgainst=null, System.Globalization.CultureInfo? culture=null);
Parameters​

input System.DateTimeOffset

The date to be humanized

dateToCompareAgainst System.Nullable<System.DateTimeOffset>

Date to compare the input against. If null, current date is used as base

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String
distance of time in words

DateHumanizeExtensions.Humanize(this Nullable<DateOnly>, Nullable<DateOnly>, CultureInfo) Method​

Turns the current or provided date into a human readable sentence, overload for the nullable DateTime, returning 'never' in case null

public static string Humanize(this System.Nullable<System.DateOnly> input, System.Nullable<System.DateOnly> dateToCompareAgainst=null, System.Globalization.CultureInfo? culture=null);
Parameters​

input System.Nullable<System.DateOnly>

The date to be humanized

dateToCompareAgainst System.Nullable<System.DateOnly>

Date to compare the input against. If null, current date is used as base

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String
distance of time in words

DateHumanizeExtensions.Humanize(this Nullable<DateTime>, Nullable<bool>, Nullable<DateTime>, CultureInfo) Method​

Turns the current or provided date into a human readable sentence, overload for the nullable DateTime, returning 'never' in case null

public static string Humanize(this System.Nullable<System.DateTime> input, System.Nullable<bool> utcDate=null, System.Nullable<System.DateTime> dateToCompareAgainst=null, System.Globalization.CultureInfo? culture=null);
Parameters​

input System.Nullable<System.DateTime>

The date to be humanized

utcDate System.Nullable<System.Boolean>

Nullable boolean value indicating whether the date is in UTC or local. If null, current date is used with the same DateTimeKind of input

dateToCompareAgainst System.Nullable<System.DateTime>

Date to compare the input against. If null, current date is used as base

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String
distance of time in words

DateHumanizeExtensions.Humanize(this Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, CultureInfo) Method​

Turns the current or provided date into a human readable sentence, overload for the nullable DateTimeOffset, returning 'never' in case null

public static string Humanize(this System.Nullable<System.DateTimeOffset> input, System.Nullable<System.DateTimeOffset> dateToCompareAgainst=null, System.Globalization.CultureInfo? culture=null);
Parameters​

input System.Nullable<System.DateTimeOffset>

The date to be humanized

dateToCompareAgainst System.Nullable<System.DateTimeOffset>

Date to compare the input against. If null, current date is used as base

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String
distance of time in words

DateHumanizeExtensions.Humanize(this Nullable<TimeOnly>, Nullable<TimeOnly>, bool, CultureInfo) Method​

Turns the current or provided time into a human readable sentence, overload for the nullable TimeOnly, returning 'never' in case null

public static string Humanize(this System.Nullable<System.TimeOnly> input, System.Nullable<System.TimeOnly> timeToCompareAgainst=null, bool useUtc=true, System.Globalization.CultureInfo? culture=null);
Parameters​

input System.Nullable<System.TimeOnly>

The date to be humanized

timeToCompareAgainst System.Nullable<System.TimeOnly>

Time to compare the input against. If null, current date is used as base

useUtc System.Boolean

If timeToCompareAgainst is null, used to determine if the current time is UTC or local. Defaults to UTC.

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String
distance of time in words

DateHumanizeExtensions.Humanize(this TimeOnly, Nullable<TimeOnly>, bool, CultureInfo) Method​

Turns the current or provided time into a human readable sentence

public static string Humanize(this System.TimeOnly input, System.Nullable<System.TimeOnly> timeToCompareAgainst=null, bool useUtc=true, System.Globalization.CultureInfo? culture=null);
Parameters​

input System.TimeOnly

The date to be humanized

timeToCompareAgainst System.Nullable<System.TimeOnly>

Date to compare the input against. If null, current date is used as base

useUtc System.Boolean

If timeToCompareAgainst is null, used to determine if the current time is UTC or local. Defaults to UTC.

culture System.Globalization.CultureInfo

Culture to use. If null, current thread's culture is used.

Returns​

System.String
distance of time in words