DateUtils.FormatSameDayTime Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| FormatSameDayTime(Int64, Int64, AbbreviationLength, AbbreviationLength) |
Obsolete.
Formats the time if the two instants are on the same day, or the date if they are on different days. |
| FormatSameDayTime(Int64, Int64, Int32, Int32) |
Format a date / time such that if the then is on the same day as now, it shows just the time and if it's a different day, it shows just the date. |
FormatSameDayTime(Int64, Int64, AbbreviationLength, AbbreviationLength)
Caution
This method was improperly bound. Please use FormatSameDayTime(Int64, Int64, Int32, Int32).
Formats the time if the two instants are on the same day, or the date if they are on different days.
[System.Obsolete("This method was improperly bound. Please use FormatSameDayTime(Int64, Int64, Int32, Int32).")]
public static string? FormatSameDayTime(long then, long now, Android.Text.Format.AbbreviationLength dateStyle, Android.Text.Format.AbbreviationLength timeStyle);
[<System.Obsolete("This method was improperly bound. Please use FormatSameDayTime(Int64, Int64, Int32, Int32).")>]
static member FormatSameDayTime : int64 * int64 * Android.Text.Format.AbbreviationLength * Android.Text.Format.AbbreviationLength -> string
Parameters
- then
- Int64
The instant to format, in milliseconds since the Unix epoch.
- now
- Int64
The reference instant for the day comparison, in milliseconds since the Unix epoch.
- dateStyle
- AbbreviationLength
The date style. This obsolete overload uses an incorrect enum type; use the overload with integer style parameters instead.
- timeStyle
- AbbreviationLength
The time style. This obsolete overload uses an incorrect enum type; use the overload with integer style parameters instead.
Returns
The formatted time or date as a string.
- Attributes
Remarks
The underlying method takes DateFormat style constants, not AbbreviationLength values. See the Android formatSameDayTime reference.
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
FormatSameDayTime(Int64, Int64, Int32, Int32)
Format a date / time such that if the then is on the same day as now, it shows just the time and if it's a different day, it shows just the date.
public static string? FormatSameDayTime(long then, long now, int dateStyle, int timeStyle);
static member FormatSameDayTime : int64 * int64 * int * int -> string
Parameters
- then
- Int64
the date to format
- now
- Int64
the base time
- dateStyle
- Int32
how to format the date portion.
- timeStyle
- Int32
how to format the time portion.
Returns
The time of then if it is on the same day as now, or its date otherwise, as a string.
Remarks
Format a date / time such that if the then is on the same day as now, it shows just the time and if it's a different day, it shows just the date.
The parameters dateFormat and timeFormat should each be one of java.text.DateFormat#DEFAULT, java.text.DateFormat#FULL, java.text.DateFormat#LONG, java.text.DateFormat#MEDIUM or java.text.DateFormat#SHORT
Java documentation for android.text.format.DateUtils.formatSameDayTime(long, long, int, 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.