Java Utililty Methods Milliseconds

List of utility methods to do Milliseconds

Description

The list of methods to do Milliseconds are organized into topic(s).

Method

intticksToMilliseconds(long ticks)
Extracts the milliseconds component of a time in millisecond ticks.
return (int) (ticks % MILLIS_PER_SECOND);
longticksWithMillisecondsSetTo(long ticks, int milliseconds)
Sets the milliseconds component of the timestamp, returning the new timestamp with updated component.
long oldMillis = ticksToMilliseconds(ticks);
return ticks - oldMillis + milliseconds;
longtilNextMillis(long lastTimestamp)
til Next Millis
long timestamp = timeGen();
while (timestamp <= lastTimestamp) {
    timestamp = timeGen();
return timestamp;
longtimeAfterMillis(final long millis)
Returns timestamp in the future after some millis passed from now
return System.currentTimeMillis() + millis;
StringtimeIncMillisToTimeControl(long startTimeMillis, long startIncMillis)
[TimeControl "60+0"]
String minutes = String.valueOf(startTimeMillis / 1000);
String inc = String.valueOf(startIncMillis / 1000);
return minutes + "+" + inc;
DatetimeMillisToDate(Long timeMillis)
time Millis To Date
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String sd = format.format(new Date(timeMillis));
Date date = format.parse(sd);
return date;
StringtimeMillisToString(long timeMillis)
time Millis To String
StringBuilder strTime = new StringBuilder();
long jour = (int) (timeMillis / 86400000);
long heure = (int) ((timeMillis - jour * 86400000) / 3600000);
long minute = (int) ((timeMillis - jour * 86400000 - heure * 3600000) / 60000);
long seconde = (int) ((timeMillis - jour * 86400000 - heure * 3600000 - minute * 60000) / 1000);
long milliseconde = (int) (timeMillis - jour * 86400000 - heure * 3600000 - minute * 60000
        - seconde * 1000);
if (jour > 0) {
...
inttimeoutPropertyToIntMillis(long value)
timeout Property To Int Millis
if (value < 0) {
    return -1;
} else if (value >= Integer.MAX_VALUE) {
    return Integer.MAX_VALUE;
} else {
    return (int) value;
longtimeSince_MILLIS(long start_PMILLIS)
time SincMILLIS
return (System.currentTimeMillis() - start_PMILLIS);
longtimeSinceMillis(long prevTime)
Get the time in millis passed since a previous time
return millis() - prevTime;