Class Duration
java.lang.Object
de.uplanet.lucy.server.scripting.velocity.util.Duration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabsolute()
Get the absolute, i.e.Format the given duration using the following format specifiers.long
getDays()
Get the days represented by this duration.long
Get the full days represented by this duration.long
Get the full hours represented by this duration.long
Get the full milliseconds represented by this duration.long
Get the full minutes represented by this duration.long
Get the full seconds represented by this duration.long
getHours()
Get the hours represented by this duration without taking into account hours that are covered by full days.long
Get the milliseconds represented by this duration without taking into account milliseconds that are covered by full seconds.long
Get the minutes represented by this duration without taking into account minutes that are covered by full hours.long
Get the seconds represented by this duration without taking into account seconds that are covered by full minutes.Round the duration to the nearest day.Round the duration to the nearest hour.Round the duration to the nearest minute.Round the duration to the nearest second.
-
Constructor Details
-
Duration
public Duration(long p_lDuration) -
Duration
public Duration(int p_iDays, int p_iHours, int p_iMinutes, int p_iSeconds, int p_iMillis)
-
-
Method Details
-
getFullDays
public long getFullDays()Get the full days represented by this duration.- Returns:
- The full days represented by this duration.
-
getDays
public long getDays()Get the days represented by this duration.This is the same as
getFullDays()
.- Returns:
- The days represented by this duration.
-
getFullHours
public long getFullHours()Get the full hours represented by this duration.- Returns:
- The full hours represented by this duration.
-
getHours
public long getHours()Get the hours represented by this duration without taking into account hours that are covered by full days.Eg. from
getFullHours() == 25
followsgetHours() == 1
.- Returns:
- The hours represented by this duration.
-
getFullMinutes
public long getFullMinutes()Get the full minutes represented by this duration.- Returns:
- The full minutes represented by this duration.
-
getMinutes
public long getMinutes()Get the minutes represented by this duration without taking into account minutes that are covered by full hours.- Returns:
- The minutes represented by this duration.
-
getFullSeconds
public long getFullSeconds()Get the full seconds represented by this duration.- Returns:
- The full seconds represented by this duration.
-
getSeconds
public long getSeconds()Get the seconds represented by this duration without taking into account seconds that are covered by full minutes.- Returns:
- The seconds represented by this duration.
-
getFullMilliseconds
public long getFullMilliseconds()Get the full milliseconds represented by this duration.- Returns:
- The full milliseconds represented by this duration.
-
getMilliseconds
public long getMilliseconds()Get the milliseconds represented by this duration without taking into account milliseconds that are covered by full seconds.- Returns:
- The milliseconds represented by this duration.
-
absolute
Get the absolute, i.e. positive duration.- Returns:
- The absolute duration.
-
roundToNearestDay
Round the duration to the nearest day.- Returns:
- The rounded duration.
-
roundToNearestHour
Round the duration to the nearest hour.- Returns:
- The rounded duration.
-
roundToNearestMinute
Round the duration to the nearest minute.- Returns:
- The rounded duration.
-
roundToNearestSecond
Round the duration to the nearest second.- Returns:
- The rounded duration.
-
format
Format the given duration using the following format specifiers.- %D - full days (see
getFullDays()
) - %d - days (see
getDays()
) - %H - full hours (see
getFullHours()
) - %h - hours (see
getHours()
) - %M - full minutes (see
getFullMinutes()
) - %m - minutes (see
getFullMinutes()
) - %S - full seconds (see
getFullSeconds()
) - %S - seconds (see
getSeconds()
) - %I - full milliseconds (see
getFullMilliseconds()
) - %i - milliseconds (see
getMilliseconds()
)
- Parameters:
p_strFormat
- The format string.- Returns:
- The formatted duration.
- %D - full days (see
-