android.util
public
class
android.util.DateUtils
Summary
Constants
Public Constructors
Public Methods
| |
|
final |
static |
CharSequence |
dateString(long startTime) |
| |
|
|
static |
String |
formatElapsedTime(long elapsedSeconds) |
| |
|
final |
static |
CharSequence |
formatSameDayTime(long then, long now, int dateStyle, int timeStyle) |
| |
|
|
static |
String |
getAMPMStr(int ampm, boolean abbrev) |
| |
|
|
static |
String |
getDayOfWeekStr(int dayOfWeek) |
| |
|
|
static |
String |
getDayOfWeekStr(int dayOfWeek, boolean abbrev) |
| |
|
final |
static |
int |
getFirstDayOfWeek() |
| |
|
|
static |
String |
getMonthStr(int month) |
| |
|
|
static |
String |
getMonthStr(int month, boolean abbrev) |
| |
|
|
static |
CharSequence |
getRelativeTimeSpanString(long time, long now, long minResolution) |
| |
|
|
static |
CharSequence |
getRelativeTimeSpanString(long startTime) |
| |
|
|
static |
CharSequence |
getRelativeTimeSpanString(long time, long now, long minResolution, String prefix, String postfix) |
| |
|
final |
static |
CharSequence |
timeString(Calendar c) |
| |
|
final |
static |
CharSequence |
timeString(long millis) |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
long
DAY_IN_MILLIS
Constant Value:
86400000
(0x0000000005265c00)
public
static
final
long
HOUR_IN_MILLIS
Constant Value:
3600000
(0x000000000036ee80)
public
static
final
long
MINUTE_IN_MILLIS
Constant Value:
60000
(0x000000000000ea60)
public
static
final
long
SECOND_IN_MILLIS
Constant Value:
1000
(0x00000000000003e8)
public
static
final
long
WEEK_IN_MILLIS
Constant Value:
604800000
(0x00000000240c8400)
public
static
final
long
YEAR_IN_MILLIS
Constant Value:
31449600000
(0x00000007528ad000)
Public Constructors
Public Methods
public
static
String
formatElapsedTime(long elapsedSeconds)
Formats an elapsed time like MM:SS or H:MM:SS
for display on the call-in-progress screen.
TODO: This probably belongs in android.util.DateUtils
(alongside functions like getRelativeTimeSpanString().)
public
static
final
CharSequence
formatSameDayTime(long then, long now, int dateStyle, int timeStyle)
public
static
String
getAMPMStr(int ampm, boolean abbrev)
public
static
String
getDayOfWeekStr(int dayOfWeek)
public
static
String
getDayOfWeekStr(int dayOfWeek, boolean abbrev)
public
static
final
int
getFirstDayOfWeek()
This method returns the value for the first day of the week. This corresponds to the values
in java.util.Calendar.
Returns
- The first day of the week. SUNDAY = 1, MONDAY = 2.
public
static
String
getMonthStr(int month)
public
static
String
getMonthStr(int month, boolean abbrev)
public
static
CharSequence
getRelativeTimeSpanString(long time, long now, long minResolution)
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".
Parameters
| time
| the time to describe, in milliseconds |
| now
| the current time in milliseconds |
| minResolution
| 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 |
public
static
CharSequence
getRelativeTimeSpanString(long startTime)
public
static
CharSequence
getRelativeTimeSpanString(long time, long now, long minResolution, String prefix, String postfix)