类 TimeSpan
java.lang.Object
cn.vorbote.core.time.TimeSpan
Represents a time interval. We use this class to show diffs from 2
DateTime instances.- 作者:
- vorbote
-
嵌套类概要
嵌套类 -
构造器概要
构造器构造器说明TimeSpan()No-args constructor, you can use this to build aTimeSpanwith 0 days, 0 hours, 0 minutes and 0 seconds.TimeSpan(int totalSeconds) This constructor will build aTimeSpanwith specific total seconds.TimeSpan(int days, int hours, int minutes, int seconds) This constructor will build aTimeSpanwith specific data. -
方法概要
修饰符和类型方法说明addDays(int days) Add days to thisTimeSpan.
Note: This method support chain call.addHours(int hours) Add hours to thisTimeSpan.
Note: This method support chain call.addMinutes(int minutes) Add minutes to thisTimeSpan.
Note: This method support chain call.addSeconds(int seconds) Add seconds to thisTimeSpan.
Note: This method support chain call.static TimeSpan.Builderbuilder()Generate a builder ofTimeSpan.booleanCheck that the givenObjectinstance is equal to this instance.intgetDays()Get the number of days between two times.intgetHours()Get the number of hours between two times.intGet the number of minutes between two times.intGet the number of seconds between two times.longGet total seconds.inthashCode()voidsetTotalSeconds(long totalSeconds) Set total seconds.toString()doubleGet the total hours in thisTimeSpan.longGet the total seconds in thisTimeSpan.totalSeconds(long totalSeconds)
-
构造器详细资料
-
TimeSpan
public TimeSpan()No-args constructor, you can use this to build aTimeSpanwith 0 days, 0 hours, 0 minutes and 0 seconds. -
TimeSpan
public TimeSpan(int totalSeconds) This constructor will build aTimeSpanwith specific total seconds.- 参数:
totalSeconds- The total seconds of thisTimeSpan
-
TimeSpan
public TimeSpan(int days, int hours, int minutes, int seconds) This constructor will build aTimeSpanwith specific data.- 参数:
days- The days of thisTimeSpan.hours- The hours of thisTimeSpan.minutes- The minutes of thisTimeSpan.seconds- The seconds of thisTimeSpan.
-
-
方法详细资料
-
getTotalSeconds
public long getTotalSeconds()Get total seconds.- 返回:
- Total seconds.
-
setTotalSeconds
public void setTotalSeconds(long totalSeconds) Set total seconds.- 参数:
totalSeconds- Total seconds.
-
getDays
public int getDays()Get the number of days between two times.- 返回:
- The number of days between two times.
-
getHours
public int getHours()Get the number of hours between two times.- 返回:
- The number of hours between two times.
-
getMinutes
public int getMinutes()Get the number of minutes between two times.- 返回:
- The number of minutes between two times.
-
getSeconds
public int getSeconds()Get the number of seconds between two times.- 返回:
- The number of seconds between two times.
-
toString
-
totalSeconds
public long totalSeconds()Get the total seconds in thisTimeSpan.- 返回:
- The total seconds in this
TimeSpan.
-
totalSeconds
-
totalHours
public double totalHours()Get the total hours in thisTimeSpan.- 返回:
- The total milliseconds in this
TimeSpan. - 另请参阅:
-
equals
Check that the givenObjectinstance is equal to this instance. -
hashCode
public int hashCode() -
builder
Generate a builder ofTimeSpan.- 返回:
- A builder of
TimeSpan.
-
addSeconds
Add seconds to thisTimeSpan.
Note: This method support chain call.- 参数:
seconds- Seconds need to be added to thisTimeSpan.- 返回:
- The
TimeSpaninstance itself.
-
addMinutes
Add minutes to thisTimeSpan.
Note: This method support chain call.- 参数:
minutes- Minutes need to be added to thisTimeSpan.- 返回:
- The
TimeSpaninstance itself.
-
addHours
Add hours to thisTimeSpan.
Note: This method support chain call.- 参数:
hours- Hours need to be added to thisTimeSpan.- 返回:
- The
TimeSpaninstance itself.
-
addDays
Add days to thisTimeSpan.
Note: This method support chain call.- 参数:
days- Days need to be added to thisTimeSpan.- 返回:
- The
TimeSpaninstance itself.
-