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

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

本文整理了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

/**
 * Returns this Calendar's time value in milliseconds.
 *
 * @return the current time as UTC milliseconds from the epoch.
 * @see #getTime()
 * @see #setTimeInMillis(long)
 */
public long getTimeInMillis() {
  if (!isTimeSet) {
    updateTime();
  }
  return time;
}

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

/**
 * Returns this Calendar's time value in milliseconds.
 *
 * @return the current time as UTC milliseconds from the epoch.
 * @see #getTime()
 * @see #setTimeInMillis(long)
 */
public long getTimeInMillis() {
  if (!isTimeSet) {
    updateTime();
  }
  return time;
}

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

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

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

/**
 * Fills in any unset fields in the calendar fields. First, the {@link
 * #computeTime()} method is called if the time value (millisecond offset
 * from the <a href="#Epoch">Epoch</a>) has not been calculated from
 * calendar field values. Then, the {@link #computeFields()} method is
 * called to calculate all calendar field values.
 */
protected void complete()
{
  if (!isTimeSet)
    updateTime();
  if (!areFieldsSet || !areAllFieldsSet) {
    computeFields(); // fills in unset fields
    areAllFieldsSet = areFieldsSet = true;
  }
}

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

/**
 * Fills in any unset fields in the calendar fields. First, the {@link
 * #computeTime()} method is called if the time value (millisecond offset
 * from the <a href="#Epoch">Epoch</a>) has not been calculated from
 * calendar field values. Then, the {@link #computeFields()} method is
 * called to calculate all calendar field values.
 */
protected void complete()
{
  if (!isTimeSet)
    updateTime();
  if (!areFieldsSet || !areAllFieldsSet) {
    computeFields(); // fills in unset fields
    areAllFieldsSet = areFieldsSet = true;
  }
}

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

updateTime();

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

updateTime();

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

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

相关文章

微信公众号

最新文章

更多