java.util.Calendar.updateTime()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(311)

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

Calendar.updateTime介绍

[英]Recomputes the time and updates the status fields isTimeSet and areFieldsSet. Callers should check isTimeSet and only call this method if isTimeSet is false.
[中]重新计算时间并更新状态字段istimet和arefieldset。调用者应该检查istimet,并且只有在istimet为false时才调用此方法。

代码示例

代码示例来源:origin: org.apidesign.bck2brwsr/emul

  1. /**
  2. * Returns this Calendar's time value in milliseconds.
  3. *
  4. * @return the current time as UTC milliseconds from the epoch.
  5. * @see #getTime()
  6. * @see #setTimeInMillis(long)
  7. */
  8. public long getTimeInMillis() {
  9. if (!isTimeSet) {
  10. updateTime();
  11. }
  12. return time;
  13. }

代码示例来源:origin: jtulach/bck2brwsr

  1. /**
  2. * Returns this Calendar's time value in milliseconds.
  3. *
  4. * @return the current time as UTC milliseconds from the epoch.
  5. * @see #getTime()
  6. * @see #setTimeInMillis(long)
  7. */
  8. public long getTimeInMillis() {
  9. if (!isTimeSet) {
  10. updateTime();
  11. }
  12. return time;
  13. }

代码示例来源:origin: stackoverflow.com

  1. Exception in thread "main" java.lang.IllegalArgumentException: DAY_OF_MONTH
  2. at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2316)
  3. at java.util.Calendar.updateTime(Calendar.java:2265)
  4. at java.util.Calendar.getTimeInMillis(Calendar.java:1049)
  5. at java.util.Calendar.getTime(Calendar.java:1022)
  6. at Question.main(Question.java:39)

代码示例来源:origin: jtulach/bck2brwsr

  1. /**
  2. * Fills in any unset fields in the calendar fields. First, the {@link
  3. * #computeTime()} method is called if the time value (millisecond offset
  4. * from the <a href="#Epoch">Epoch</a>) has not been calculated from
  5. * calendar field values. Then, the {@link #computeFields()} method is
  6. * called to calculate all calendar field values.
  7. */
  8. protected void complete()
  9. {
  10. if (!isTimeSet)
  11. updateTime();
  12. if (!areFieldsSet || !areAllFieldsSet) {
  13. computeFields(); // fills in unset fields
  14. areAllFieldsSet = areFieldsSet = true;
  15. }
  16. }

代码示例来源:origin: org.apidesign.bck2brwsr/emul

  1. /**
  2. * Fills in any unset fields in the calendar fields. First, the {@link
  3. * #computeTime()} method is called if the time value (millisecond offset
  4. * from the <a href="#Epoch">Epoch</a>) has not been calculated from
  5. * calendar field values. Then, the {@link #computeFields()} method is
  6. * called to calculate all calendar field values.
  7. */
  8. protected void complete()
  9. {
  10. if (!isTimeSet)
  11. updateTime();
  12. if (!areFieldsSet || !areAllFieldsSet) {
  13. computeFields(); // fills in unset fields
  14. areAllFieldsSet = areFieldsSet = true;
  15. }
  16. }

代码示例来源:origin: jtulach/bck2brwsr

  1. updateTime();

代码示例来源:origin: org.apidesign.bck2brwsr/emul

  1. updateTime();

代码示例来源:origin: stackoverflow.com

  1. java.lang.IllegalArgumentException: DAY_OF_MONTH
  2. at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2316)
  3. at java.util.Calendar.updateTime(Calendar.java:2260)
  4. at java.util.Calendar.complete(Calendar.java:1305)
  5. at java.util.Calendar.get(Calendar.java:1088)

相关文章