C# Class DateTimeToNaturalTimeExtension, extensions

Converts a date time to a readable natural time (i.e. '10 hours', '2 years') or relative time (i.e. '5 days ago').
Mostrar archivo Open project: netfx/extensions

Public Methods

Method Description
ToNaturalRelativeTime ( this date ) : string

Renders the given date as a natural language string, appending the "ago" suffix like "10 minutes ago".

ToNaturalTime ( this date ) : string

Renders the given date as a natural language string, like "10 minutes".

Private Methods

Method Description
ToNaturalString ( this date, bool prependAgo ) : string

Method Details

ToNaturalRelativeTime() public static method

Renders the given date as a natural language string, appending the "ago" suffix like "10 minutes ago".
public static ToNaturalRelativeTime ( this date ) : string
date this The date to convert.
return string

ToNaturalTime() public static method

Renders the given date as a natural language string, like "10 minutes".
public static ToNaturalTime ( this date ) : string
date this The date to convert.
return string