java.util.Date.setSeconds()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(211)

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

Date.setSeconds介绍

[英]Sets the gregorian calendar second of the minute for this Date object.
[中]设置此日期对象的公历每分钟秒数。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public void setSeconds(int seconds) {
 checkFrozen();
 super.setSeconds(seconds);
}

代码示例来源:origin: tianshaojie/AndroidFine

public static String getSimpleTimeString(long time) {
  String strTemp = "";
  Date dateCreate = new Date(time);
  Date dateNow = new Date();
  dateNow.setHours(0);
  dateNow.setMinutes(0);
  dateNow.setSeconds(0);
  if (dateCreate.before(dateNow)) {
    SimpleDateFormat myFmt2 = new SimpleDateFormat("MM-dd");
    myFmt2.setTimeZone(TimeZone.getDefault());
    strTemp = myFmt2.format(dateCreate);
  } else {
    SimpleDateFormat myFmt2 = new SimpleDateFormat("HH:mm");
    myFmt2.setTimeZone(TimeZone.getDefault());
    strTemp = myFmt2.format(dateCreate);
  }
  return strTemp;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Resets the date to have no time modifiers. Note that the hour might not be zero if the time
 * hits a DST transition date.
 *
 * @param date the date
 */
@SuppressWarnings("deprecation") // GWT requires Date
public static void resetTime(Date date) {
 long msec = resetMilliseconds(date.getTime());
 date.setTime(msec);
 date.setHours(0);
 date.setMinutes(0);
 date.setSeconds(0);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

date.setSeconds(this.seconds);

代码示例来源:origin: naver/ngrinder

@SuppressWarnings("deprecation")
@Test
public void testCompareDateEndWithMinute() {
  Date date1 = new Date();
  date1.setSeconds(0);
  Date date2 = new Date(date1.getTime());
  date2.setSeconds(10);
  assertTrue(DateUtils.compareDateEndWithMinute(date1, date2));
  assertTrue(DateUtils.compareDateEndWithMinute(date1, date1));
  date2 = new Date(date1.getTime());
  if (date1.getMinutes() > 1) {
    date2.setMinutes(date1.getMinutes() - 1);
  } else {
    date2.setMinutes(date1.getMinutes() + 1);
  }
  assertTrue(!DateUtils.compareDateEndWithMinute(date1, date2));
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
public void setSeconds(int seconds) {
 checkFrozen();
 super.setSeconds(seconds);
}

代码示例来源:origin: com.google.web.bindery/requestfactory-server

@Override
public void setSeconds(int seconds) {
 checkFrozen();
 super.setSeconds(seconds);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Override
public void setSeconds(int seconds) {
 checkFrozen();
 super.setSeconds(seconds);
}

代码示例来源:origin: net.java.dev.jna/jna-platform

public void setFromJavaDate(Date javaDate) {
    double msSinceOrigin = javaDate.getTime() - DATE_OFFSET;
    double daysAsFract = msSinceOrigin / MICRO_SECONDS_PER_DAY;
    Date dayDate = new Date(javaDate.getTime());
    dayDate.setHours(0);
    dayDate.setMinutes(0);
    dayDate.setSeconds(0);
    dayDate.setTime(dayDate.getTime() / 1000 * 1000); // Clear milliseconds
    double integralPart = Math.floor(daysAsFract);
    double fractionalPart = Math.signum(daysAsFract) * ((javaDate.getTime() - dayDate.getTime()) / (24d * 60 * 60 * 1000));
    this.date = integralPart + fractionalPart;
  }
}

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

AlarmManager am = (AlarmManager) con.getSystemService(Context.ALARM_SERVICE);

Date futureDate = new Date(new Date().getTime() + 86400000);

futureDate.setHours(8);
futureDate.setMinutes(0);
futureDate.setSeconds(0);

Intent intent = new Intent(con, MyAppReciever.class);

PendingIntent sender = PendingIntent.getBroadcast(con, 0, intent,
    PendingIntent.FLAG_UPDATE_CURRENT);

代码示例来源:origin: com.centurylink.mdw/mdw-common

@SuppressWarnings("deprecation")
protected static Date getRoundDate(Date date) {
  Date roundDate = new Date(date.getTime());
  roundDate.setHours(0);
  roundDate.setMinutes(0);
  roundDate.setSeconds(0);
  return roundDate;
}

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

Date midnight = new Date();
midnight.setHours(0);
midnight.setMinutes(0);
midnight.setSeconds(0);

Date elevenfiftynine = new Date();
elevenfiftynine.setHours(23);
elevenfiftynine.setMinutes(59);
elevenfiftynine.setSeconds(59);

query.whereGreaterThan(Constants.CREATED_AT_KEY, midnight);
query.whereLessThan(Constants.CREATED_AT_KEY, elevenfiftynine);

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

boolean isBeforeToday(Date d) {
   Date today = new Date();
   today.setHours(0);
   today.setMinutes(0);
   today.setSeconds(0);
   return d.before(today);
 }

代码示例来源:origin: protegeproject/webprotege

/**
 * Taken from {@link com.google.gwt.user.datepicker.client.CalendarUtil}
 */
private static void resetTime(Date date) {
  long msec = resetMilliseconds(date.getTime());
  date.setTime(msec);
  date.setHours(0);
  date.setMinutes(0);
  date.setSeconds(0);
}

代码示例来源:origin: EvoSuite/evosuite

@SuppressWarnings("deprecation")
public void setSeconds(int seconds) {
  Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, this, "setSeconds", "(I)V", new Object[] {seconds});
  super.setSeconds(seconds);
  Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, this, CaptureLog.RETURN_TYPE_VOID);
}

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

AlarmManager am = (AlarmManager) con
     .getSystemService(Context.ALARM_SERVICE);
 Date futureDate = new Date(new Date().getTime() + 86400000);
 futureDate.setHours(8);
 futureDate.setMinutes(0);
 futureDate.setSeconds(0);
 Intent intent = new Intent(con, MyAppReciever.class);
 PendingIntent sender = PendingIntent.getBroadcast(con, 0, intent,
     PendingIntent.FLAG_UPDATE_CURRENT);
 am.set(AlarmManager.RTC_WAKEUP, futureDate.getTimeInMillis(), sender);

代码示例来源:origin: fjfd/microscope

public void onClick(final ClickEvent event) {
    @SuppressWarnings(/* GWT requires us to use Date */{"deprecation"})
    Date d = box.getValue();
    if (d == null) {
      d = new Date();
      d.setMinutes(0);
    }
    d.setHours(hours);
    d.setSeconds(0);
    setDate(d);
  }
});

代码示例来源:origin: org.openmuc/openiec61850

@SuppressWarnings("deprecation")
  @Override
  protected void writeImpl() {
    Date newDate = dateChooser.getDate();
    Date timeValues = (Date) timeSpinner.getValue();
    newDate.setHours(timeValues.getHours());
    newDate.setMinutes(timeValues.getMinutes());
    newDate.setSeconds(timeValues.getSeconds());
    data.setDate(newDate);
  }
}

代码示例来源:origin: org.dashbuilder/dashbuilder-dataset-api

@Before
public void setUp() throws Exception {
  Date startTime = new Date();
  startTime.setYear(115);
  startTime.setMonth(10);
  startTime.setDate(10);
  startTime.setHours(12);
  startTime.setMinutes(50);
  startTime.setSeconds(30);
  TimeInstant.START_TIME = startTime;
}

代码示例来源:origin: org.kie.soup/kie-soup-dataset-api

@Before
public void setUp() throws Exception {
  Date startTime = new Date();
  startTime.setYear(115);
  startTime.setMonth(10);
  startTime.setDate(10);
  startTime.setHours(12);
  startTime.setMinutes(50);
  startTime.setSeconds(30);
  TimeInstant.START_TIME = startTime;
}

相关文章