语言

DateUtils.FormatSameDayTime 方法

定义

重载

名称 说明
FormatSameDayTime(Int64, Int64, AbbreviationLength, AbbreviationLength)
已过时.

如果两个实例在同一天,则设置时间的格式;如果两个实例位于不同日期,则设置日期的格式。

FormatSameDayTime(Int64, Int64, Int32, Int32)

设置日期/时间的格式,以便如果当时与现在位于同一天,则只显示时间,如果日期不同,则只显示日期。

FormatSameDayTime(Int64, Int64, AbbreviationLength, AbbreviationLength)

注意

This method was improperly bound. Please use FormatSameDayTime(Int64, Int64, Int32, Int32).

如果两个实例在同一天,则设置时间的格式;如果两个实例位于不同日期,则设置日期的格式。

[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

参数

then
Int64

自 Unix 纪元以来的即时格式(以毫秒为单位)。

now
Int64

与 Unix 纪元以来的日期比较的引用即时(以毫秒为单位)。

dateStyle
AbbreviationLength

日期样式。 此过时重载使用不正确的枚举类型;请改用带整数样式参数的重载。

timeStyle
AbbreviationLength

时间样式。 此过时重载使用不正确的枚举类型;请改用带整数样式参数的重载。

返回

格式的时间或日期作为字符串。

特性

注解

基础方法采用 DateFormat 样式常量,而不是 AbbreviationLength 值。 请参阅 Android formatSameDayTime 参考。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

FormatSameDayTime(Int64, Int64, Int32, Int32)

设置日期/时间的格式,以便如果当时与现在位于同一天,则只显示时间,如果日期不同,则只显示日期。

public static string? FormatSameDayTime(long then, long now, int dateStyle, int timeStyle);
static member FormatSameDayTime : int64 * int64 * int * int -> string

参数

then
Int64

要设置格式的日期

now
Int64

基本时间

dateStyle
Int32

如何设置日期部分的格式。

timeStyle
Int32

如何设置时间部分的格式。

返回

then如果时间与字符串位于同一天now或日期,则为字符串。

注解

设置日期/时间的格式,以便如果当时与现在位于同一天,则只显示时间,如果日期不同,则只显示日期。

参数 dateFormat 和 timeFormat 应分别为 <a0/> 或

适用于 . 的 android.text.format.DateUtils.formatSameDayTime(long, long, int, int)Java 文档

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于