次の方法で共有


DateUtils.GetRelativeDateTimeStringFormatted Method

Definition

Return string describing the elapsed time since startTime formatted like "[relative time/date], [time]".

[Android.Runtime.Register("getRelativeDateTimeString", "(Landroid/content/Context;JJJI)Ljava/lang/CharSequence;", "")]
public static Java.Lang.ICharSequence? GetRelativeDateTimeStringFormatted (Android.Content.Context? c, long time, long minResolution, long transitionResolution, Android.Text.Format.FormatStyleFlags flags);
[<Android.Runtime.Register("getRelativeDateTimeString", "(Landroid/content/Context;JJJI)Ljava/lang/CharSequence;", "")>]
static member GetRelativeDateTimeStringFormatted : Android.Content.Context * int64 * int64 * int64 * Android.Text.Format.FormatStyleFlags -> Java.Lang.ICharSequence

Parameters

time
Int64

some time in the past.

minResolution
Int64

the minimum elapsed time (in milliseconds) to report when showing relative times. For example, a time 3 seconds in the past will be reported as "0 minutes ago" if this is set to #MINUTE_IN_MILLIS.

transitionResolution
Int64

the elapsed time (in milliseconds) at which to stop reporting relative measurements. Elapsed times greater than this resolution will default to normal date formatting. For example, will transition from "7 days ago" to "Dec 12" when using #WEEK_IN_MILLIS.

Returns

Attributes

Remarks

Return string describing the elapsed time since startTime formatted like "[relative time/date], [time]".

Example output strings for the US date format. <ul> <li>3 min. ago, 10:15 AM</li> <li>Yesterday, 12:20 PM</li> <li>Dec 12, 4:12 AM</li> <li>11/14/2007, 8:20 AM</li> </ul>

Java documentation for android.text.format.DateUtils.getRelativeDateTimeString(android.content.Context, 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