Humanizer.DefaultTimeSpanHumanizeStrategy
DefaultTimeSpanHumanizeStrategy Class
The default strategy for converting System.TimeSpan values into human-readable text.
public class DefaultTimeSpanHumanizeStrategy : Humanizer.IGrammaticalCaseTimeSpanHumanizeStrategy, Humanizer.ITimeSpanHumanizeStrategy
Inheritance System.Object → DefaultTimeSpanHumanizeStrategy
Implements IGrammaticalCaseTimeSpanHumanizeStrategy, ITimeSpanHumanizeStrategy
Methods
DefaultTimeSpanHumanizeStrategy.Humanize(TimeSpan, int, bool, CultureInfo, TimeUnit, TimeUnit, string, bool, bool) Method
Converts a System.TimeSpan into human-readable text.
public string Humanize(System.TimeSpan timeSpan, int precision, bool countEmptyUnits, System.Globalization.CultureInfo? culture, Humanizer.TimeUnit maxUnit, Humanizer.TimeUnit minUnit, string? collectionSeparator, bool toWords, bool toSymbols);
Parameters
timeSpan System.TimeSpan
The time span to humanize.
precision System.Int32
The maximum number of time units to return.
countEmptyUnits System.Boolean
Whether empty time units count toward precision.
culture System.Globalization.CultureInfo
The culture to use. If null, the current culture is used.
maxUnit TimeUnit
The maximum unit of time to output.
minUnit TimeUnit
The minimum unit of time to output.
collectionSeparator System.String
The separator used to combine time parts. If null, the culture's default collection formatter is used.
toWords System.Boolean
Whether numbers are rendered as words.
toSymbols System.Boolean
Whether time units are rendered as symbols.
Implements Humanize(TimeSpan, int, bool, CultureInfo, TimeUnit, TimeUnit, string, bool, bool)
Returns
System.String
The human-readable time span.
DefaultTimeSpanHumanizeStrategy.HumanizeWithFractionalSeconds(TimeSpan, int, bool, CultureInfo, TimeUnit, string, int, MidpointRounding, bool) Method
Converts a System.TimeSpan into human-readable text with seconds as the minimum unit.
public virtual string HumanizeWithFractionalSeconds(System.TimeSpan timeSpan, int precision, bool countEmptyUnits, System.Globalization.CultureInfo? culture, Humanizer.TimeUnit maxUnit, string? collectionSeparator, int maxFractionalDigits, System.MidpointRounding roundingMode, bool toSymbols);
Parameters
timeSpan System.TimeSpan
The time span to humanize.
precision System.Int32
The maximum number of time units to return.
countEmptyUnits System.Boolean
Whether empty time units count toward precision.
culture System.Globalization.CultureInfo
The culture to use. If null, the current culture is used.
maxUnit TimeUnit
The maximum unit of time to output.
collectionSeparator System.String
The separator used to combine time parts. If null, the culture's default collection formatter is used.
maxFractionalDigits System.Int32
The maximum number of fractional-second digits, from 0 through 7.
roundingMode System.MidpointRounding
The midpoint rounding mode.
toSymbols System.Boolean
Whether time units are rendered as symbols.
Returns
System.String
The human-readable time span.
Explicit Interface Implementations
Humanizer.IGrammaticalCaseTimeSpanHumanizeStrategy.Humanize(TimeSpan, int, bool, CultureInfo, TimeUnit, TimeUnit, string, bool, GrammaticalCase) Method
string Humanizer.IGrammaticalCaseTimeSpanHumanizeStrategy.Humanize(System.TimeSpan timeSpan, int precision, bool countEmptyUnits, System.Globalization.CultureInfo? culture, Humanizer.TimeUnit maxUnit, Humanizer.TimeUnit minUnit, string? collectionSeparator, bool toSymbols, Humanizer.GrammaticalCase grammaticalCase);
Parameters
timeSpan System.TimeSpan
precision System.Int32
countEmptyUnits System.Boolean
culture System.Globalization.CultureInfo
maxUnit TimeUnit
minUnit TimeUnit
collectionSeparator System.String
toSymbols System.Boolean
grammaticalCase GrammaticalCase
Implements Humanize(TimeSpan, int, bool, CultureInfo, TimeUnit, TimeUnit, string, bool, GrammaticalCase)