org.joda.time.LocalTime.getChronology()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中org.joda.time.LocalTime.getChronology()方法的一些代码示例,展示了LocalTime.getChronology()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalTime.getChronology()方法的具体详情如下:
包路径:org.joda.time.LocalTime
类名称:LocalTime
方法名:getChronology

LocalTime.getChronology介绍

[英]Gets the chronology of the time.
[中]获取时间的年表。

代码示例

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Returns a copy of this time with different local millis.
  3. * <p>
  4. * The returned object will be a new instance of the same type.
  5. * Only the millis will change, the chronology is kept.
  6. * The returned object will be either be a new instance or <code>this</code>.
  7. *
  8. * @param newMillis the new millis, from 1970-01-01T00:00:00
  9. * @return a copy of this time with different millis
  10. */
  11. LocalTime withLocalMillis(long newMillis) {
  12. return (newMillis == getLocalMillis() ? this : new LocalTime(newMillis, getChronology()));
  13. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Returns a copy of this time with the partial set of fields replacing
  3. * those from this instance.
  4. * <p>
  5. * For example, if the partial contains an hour and minute then those two
  6. * fields will be changed in the returned instance.
  7. * Unsupported fields are ignored.
  8. * If the partial is null, then <code>this</code> is returned.
  9. *
  10. * @param partial the partial set of fields to apply to this time, null ignored
  11. * @return a copy of this time with a different set of fields
  12. * @throws IllegalArgumentException if any value is invalid
  13. */
  14. public LocalTime withFields(ReadablePartial partial) {
  15. if (partial == null) {
  16. return this;
  17. }
  18. return withLocalMillis(getChronology().set(partial, getLocalMillis()));
  19. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Returns a copy of this time with the specified period added.
  3. * <p>
  4. * If the addition is zero, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add multiple copies of complex
  7. * period instances. Adding one field is best achieved using methods
  8. * like {@link #withFieldAdded(DurationFieldType, int)}
  9. * or {@link #plusHours(int)}.
  10. *
  11. * @param period the period to add to this one, null means zero
  12. * @param scalar the amount of times to add, such as -1 to subtract once
  13. * @return a copy of this time with the period added
  14. * @throws ArithmeticException if the result exceeds the internal capacity
  15. */
  16. public LocalTime withPeriodAdded(ReadablePeriod period, int scalar) {
  17. if (period == null || scalar == 0) {
  18. return this;
  19. }
  20. long instant = getChronology().add(period, getLocalMillis(), scalar);
  21. return withLocalMillis(instant);
  22. }

代码示例来源:origin: JodaOrg/joda-time

  1. /**
  2. * Returns a copy of this time with different local millis.
  3. * <p>
  4. * The returned object will be a new instance of the same type.
  5. * Only the millis will change, the chronology is kept.
  6. * The returned object will be either be a new instance or <code>this</code>.
  7. *
  8. * @param newMillis the new millis, from 1970-01-01T00:00:00
  9. * @return a copy of this time with different millis
  10. */
  11. LocalTime withLocalMillis(long newMillis) {
  12. return (newMillis == getLocalMillis() ? this : new LocalTime(newMillis, getChronology()));
  13. }

代码示例来源:origin: JodaOrg/joda-time

  1. /**
  2. * Returns a copy of this time with the partial set of fields replacing
  3. * those from this instance.
  4. * <p>
  5. * For example, if the partial contains an hour and minute then those two
  6. * fields will be changed in the returned instance.
  7. * Unsupported fields are ignored.
  8. * If the partial is null, then <code>this</code> is returned.
  9. *
  10. * @param partial the partial set of fields to apply to this time, null ignored
  11. * @return a copy of this time with a different set of fields
  12. * @throws IllegalArgumentException if any value is invalid
  13. */
  14. public LocalTime withFields(ReadablePartial partial) {
  15. if (partial == null) {
  16. return this;
  17. }
  18. return withLocalMillis(getChronology().set(partial, getLocalMillis()));
  19. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Get the hour of day field value.
  3. *
  4. * @return the hour of day
  5. */
  6. public int getHourOfDay() {
  7. return getChronology().hourOfDay().get(getLocalMillis());
  8. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Returns a copy of this time with the millis of day field updated.
  3. * <p>
  4. * LocalTime is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * millis of day changed.
  7. *
  8. * @param millis the millis of day to set
  9. * @return a copy of this object with the field set
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public LocalTime withMillisOfDay(int millis) {
  13. return withLocalMillis(getChronology().millisOfDay().set(getLocalMillis(), millis));
  14. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Get the minute of hour field value.
  3. *
  4. * @return the minute of hour
  5. */
  6. public int getMinuteOfHour() {
  7. return getChronology().minuteOfHour().get(getLocalMillis());
  8. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Returns a copy of this time with the hour of day field updated.
  3. * <p>
  4. * LocalTime is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * hour of day changed.
  7. *
  8. * @param hour the hour of day to set
  9. * @return a copy of this object with the field set
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public LocalTime withHourOfDay(int hour) {
  13. return withLocalMillis(getChronology().hourOfDay().set(getLocalMillis(), hour));
  14. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Get the millis of day field value.
  3. *
  4. * @return the millis of day
  5. */
  6. public int getMillisOfDay() {
  7. return getChronology().millisOfDay().get(getLocalMillis());
  8. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Returns a copy of this time with the minute of hour field updated.
  3. * <p>
  4. * LocalTime is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * minute of hour changed.
  7. *
  8. * @param minute the minute of hour to set
  9. * @return a copy of this object with the field set
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public LocalTime withMinuteOfHour(int minute) {
  13. return withLocalMillis(getChronology().minuteOfHour().set(getLocalMillis(), minute));
  14. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Get the second of minute field value.
  3. *
  4. * @return the second of minute
  5. */
  6. public int getSecondOfMinute() {
  7. return getChronology().secondOfMinute().get(getLocalMillis());
  8. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Returns a copy of this time with the second of minute field updated.
  3. * <p>
  4. * LocalTime is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * second of minute changed.
  7. *
  8. * @param second the second of minute to set
  9. * @return a copy of this object with the field set
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public LocalTime withSecondOfMinute(int second) {
  13. return withLocalMillis(getChronology().secondOfMinute().set(getLocalMillis(), second));
  14. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Get the millis of second field value.
  3. *
  4. * @return the millis of second
  5. */
  6. public int getMillisOfSecond() {
  7. return getChronology().millisOfSecond().get(getLocalMillis());
  8. }

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Returns a copy of this time with the millis of second field updated.
  3. * <p>
  4. * LocalTime is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * millis of second changed.
  7. *
  8. * @param millis the millis of second to set
  9. * @return a copy of this object with the field set
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public LocalTime withMillisOfSecond(int millis) {
  13. return withLocalMillis(getChronology().millisOfSecond().set(getLocalMillis(), millis));
  14. }

代码示例来源:origin: JodaOrg/joda-time

  1. /**
  2. * Get the millis of second field value.
  3. *
  4. * @return the millis of second
  5. */
  6. public int getMillisOfSecond() {
  7. return getChronology().millisOfSecond().get(getLocalMillis());
  8. }

代码示例来源:origin: JodaOrg/joda-time

  1. /**
  2. * Returns a copy of this time with the specified period added.
  3. * <p>
  4. * If the addition is zero, then <code>this</code> is returned.
  5. * <p>
  6. * This method is typically used to add multiple copies of complex
  7. * period instances. Adding one field is best achieved using methods
  8. * like {@link #withFieldAdded(DurationFieldType, int)}
  9. * or {@link #plusHours(int)}.
  10. *
  11. * @param period the period to add to this one, null means zero
  12. * @param scalar the amount of times to add, such as -1 to subtract once
  13. * @return a copy of this time with the period added
  14. * @throws ArithmeticException if the result exceeds the internal capacity
  15. */
  16. public LocalTime withPeriodAdded(ReadablePeriod period, int scalar) {
  17. if (period == null || scalar == 0) {
  18. return this;
  19. }
  20. long instant = getChronology().add(period, getLocalMillis(), scalar);
  21. return withLocalMillis(instant);
  22. }

代码示例来源:origin: JodaOrg/joda-time

  1. /**
  2. * Get the hour of day field value.
  3. *
  4. * @return the hour of day
  5. */
  6. public int getHourOfDay() {
  7. return getChronology().hourOfDay().get(getLocalMillis());
  8. }

代码示例来源:origin: JodaOrg/joda-time

  1. /**
  2. * Returns a copy of this time with the hour of day field updated.
  3. * <p>
  4. * LocalTime is immutable, so there are no set methods.
  5. * Instead, this method returns a new instance with the value of
  6. * hour of day changed.
  7. *
  8. * @param hour the hour of day to set
  9. * @return a copy of this object with the field set
  10. * @throws IllegalArgumentException if the value is invalid
  11. */
  12. public LocalTime withHourOfDay(int hour) {
  13. return withLocalMillis(getChronology().hourOfDay().set(getLocalMillis(), hour));
  14. }

代码示例来源:origin: JodaOrg/joda-time

  1. /**
  2. * Get the millis of day field value.
  3. *
  4. * @return the millis of day
  5. */
  6. public int getMillisOfDay() {
  7. return getChronology().millisOfDay().get(getLocalMillis());
  8. }

相关文章