Edit

Share via


DateTimeExtensions.GetRelativeTime(DateTime) Method

Definition

Gets string literal for relative time from now since the DateTime provided. String output is in most appropriate "x time units ago" Example: If DateTime provided is 30 seconds before now, then result will be "30 seconds ago"

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ GetRelativeTime(DateTime time);
public static string GetRelativeTime (this DateTime time);
static member GetRelativeTime : DateTime -> string
<Extension()>
Public Function GetRelativeTime (time As DateTime) As String

Parameters

time
DateTime

DateTime in UTC to compare against DateTime.UtcNow

Returns

Encoded string.

Applies to