Condividi tramite


DateUtils.GetRelativeTimeSpanStringFormatted Method

Definition

Overloads

GetRelativeTimeSpanStringFormatted(Int64)

Returns a string describing the elapsed time since startTime.

GetRelativeTimeSpanStringFormatted(Context, Int64)

Convenience function to return relative time string without preposition.

GetRelativeTimeSpanStringFormatted(Context, Int64, Boolean)

Returns a string describing the elapsed time since startTime.

GetRelativeTimeSpanStringFormatted(Int64, Int64, Int64)

Returns a string describing 'time' as a time relative to 'now'.

GetRelativeTimeSpanStringFormatted(Int64, Int64, Int64, FormatStyleFlags)

Returns a string describing 'time' as a time relative to 'now'.

GetRelativeTimeSpanStringFormatted(Int64)

Returns a string describing the elapsed time since startTime.

[Android.Runtime.Register("getRelativeTimeSpanString", "(J)Ljava/lang/CharSequence;", "")]
public static Java.Lang.ICharSequence? GetRelativeTimeSpanStringFormatted (long startTime);
[<Android.Runtime.Register("getRelativeTimeSpanString", "(J)Ljava/lang/CharSequence;", "")>]
static member GetRelativeTimeSpanStringFormatted : int64 -> Java.Lang.ICharSequence

Parameters

startTime
Int64

some time in the past.

Returns

a String object containing the elapsed time.

Attributes

Remarks

Returns a string describing the elapsed time since startTime.

The minimum timespan to report is set to #MINUTE_IN_MILLIS.

Java documentation for android.text.format.DateUtils.getRelativeTimeSpanString(long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

  • <xref:Android.Text.Format.DateUtils.GetRelativeTimeSpanStringFormatted(System.Int64%2c+System.Int64%2c+System.Int64)>

Applies to

GetRelativeTimeSpanStringFormatted(Context, Int64)

Convenience function to return relative time string without preposition.

[Android.Runtime.Register("getRelativeTimeSpanString", "(Landroid/content/Context;J)Ljava/lang/CharSequence;", "")]
public static Java.Lang.ICharSequence? GetRelativeTimeSpanStringFormatted (Android.Content.Context? c, long millis);
[<Android.Runtime.Register("getRelativeTimeSpanString", "(Landroid/content/Context;J)Ljava/lang/CharSequence;", "")>]
static member GetRelativeTimeSpanStringFormatted : Android.Content.Context * int64 -> Java.Lang.ICharSequence

Parameters

c
Context

context for resources

millis
Int64

time in milliseconds

Returns

CharSequence containing relative time.

Attributes

Remarks

Convenience function to return relative time string without preposition.

Java documentation for android.text.format.DateUtils.getRelativeTimeSpanString(android.content.Context, long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

  • <xref:Android.Text.Format.DateUtils.GetRelativeTimeSpanStringFormatted(Android.Content.Context%2c+System.Int64%2c+System.Int64)>

Applies to

GetRelativeTimeSpanStringFormatted(Context, Int64, Boolean)

Returns a string describing the elapsed time since startTime.

[Android.Runtime.Register("getRelativeTimeSpanString", "(Landroid/content/Context;JZ)Ljava/lang/CharSequence;", "")]
public static Java.Lang.ICharSequence? GetRelativeTimeSpanStringFormatted (Android.Content.Context? c, long millis, bool withPreposition);
[<Android.Runtime.Register("getRelativeTimeSpanString", "(Landroid/content/Context;JZ)Ljava/lang/CharSequence;", "")>]
static member GetRelativeTimeSpanStringFormatted : Android.Content.Context * int64 * bool -> Java.Lang.ICharSequence

Parameters

millis
Int64
withPreposition
Boolean

If true, the string returned will include the correct preposition ("at 9:20am", "on 10/12/2008" or "on May 29").

Returns

a relative time string to display the time expressed by millis. Times are counted starting at midnight, which means that assuming that the current time is March 31st, 0:30: <ul> <li>"millis=0:10 today" will be displayed as "0:10"</li> <li>"millis=11:30pm the day before" will be displayed as "Mar 30"</li> </ul> If the given millis is in a different year, then the full date is returned in numeric format (e.g., "10/12/2008").

Attributes

Remarks

Java documentation for android.text.format.DateUtils.getRelativeTimeSpanString(android.content.Context, long, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

GetRelativeTimeSpanStringFormatted(Int64, Int64, Int64)

Returns a string describing 'time' as a time relative to 'now'.

[Android.Runtime.Register("getRelativeTimeSpanString", "(JJJ)Ljava/lang/CharSequence;", "")]
public static Java.Lang.ICharSequence? GetRelativeTimeSpanStringFormatted (long time, long now, long minResolution);
[<Android.Runtime.Register("getRelativeTimeSpanString", "(JJJ)Ljava/lang/CharSequence;", "")>]
static member GetRelativeTimeSpanStringFormatted : int64 * int64 * int64 -> Java.Lang.ICharSequence

Parameters

time
Int64

the time to describe, in milliseconds

now
Int64

the current time in milliseconds

minResolution
Int64

the minimum timespan to report. For example, a time 3 seconds in the past will be reported as "0 minutes ago" if this is set to MINUTE_IN_MILLIS. Pass one of 0, MINUTE_IN_MILLIS, HOUR_IN_MILLIS, DAY_IN_MILLIS, WEEK_IN_MILLIS

Returns

a String object containing the elapsed time.

Attributes

Remarks

Returns a string describing 'time' as a time relative to 'now'.

Time spans in the past are formatted like "42 minutes ago". Time spans in the future are formatted like "In 42 minutes".

Java documentation for android.text.format.DateUtils.getRelativeTimeSpanString(long, long, long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

GetRelativeTimeSpanStringFormatted(Int64, Int64, Int64, FormatStyleFlags)

Returns a string describing 'time' as a time relative to 'now'.

[Android.Runtime.Register("getRelativeTimeSpanString", "(JJJI)Ljava/lang/CharSequence;", "")]
public static Java.Lang.ICharSequence? GetRelativeTimeSpanStringFormatted (long time, long now, long minResolution, Android.Text.Format.FormatStyleFlags flags);
[<Android.Runtime.Register("getRelativeTimeSpanString", "(JJJI)Ljava/lang/CharSequence;", "")>]
static member GetRelativeTimeSpanStringFormatted : int64 * int64 * int64 * Android.Text.Format.FormatStyleFlags -> Java.Lang.ICharSequence

Parameters

time
Int64

the time to describe, in milliseconds

now
Int64

the current time in milliseconds

minResolution
Int64

the minimum timespan to report. For example, a time 3 seconds in the past will be reported as "0 minutes ago" if this is set to MINUTE_IN_MILLIS. Pass one of 0, MINUTE_IN_MILLIS, HOUR_IN_MILLIS, DAY_IN_MILLIS, WEEK_IN_MILLIS

flags
FormatStyleFlags

a bit mask of formatting options, such as #FORMAT_NUMERIC_DATE or #FORMAT_ABBREV_RELATIVE

Returns

a String object containing the elapsed time.

Attributes

Remarks

Returns a string describing 'time' as a time relative to 'now'.

Time spans in the past are formatted like "42 minutes ago". Time spans in the future are formatted like "In 42 minutes".

Can use #FORMAT_ABBREV_RELATIVE flag to use abbreviated relative times, like "42 mins ago".

Java documentation for android.text.format.DateUtils.getRelativeTimeSpanString(long, long, long, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to