Package org.joda.time

Examples of org.joda.time.DateTime.minusSeconds()


    DateTime lastSeen = val.getLastSeen();
   
    DateTime now = new DateTime();
    DateTime before = now.minus(rateInMillis);
    //give it 15 seconds before it really should be up to date in the table
    before = before.minusSeconds(15);
   
    if(lastSeen.isBefore(before)) {
      return false;
    }
    return true;
View Full Code Here


    if (start == null) {
      // set start to current time, rounded to hours
      DateTime startDate = DateTime.now();
      startDate = startDate.plusHours(1);
      startDate = startDate.minusMinutes(startDate.getMinuteOfHour());
      startDate = startDate.minusSeconds(startDate.getSecondOfMinute());
      startDate = startDate.minusMillis(startDate.getMillisOfSecond());
      start = startDate.toString();
    }
    ObjectNode startObj = JOM.createObjectNode();
    startObj.put("dateTime", start);
View Full Code Here

   * @return
   */
  private DateTime getNextHalfHour() {
    DateTime next = DateTime.now();
    next = next.minusMillis(next.getMillisOfSecond());
    next = next.minusSeconds(next.getSecondOfMinute());

    if (next.getMinuteOfHour() > 30) {
      next = next.minusMinutes(next.getMinuteOfHour());
      next = next.plusMinutes(60);
    } else {
View Full Code Here

   * @return
   */
  private DateTime getNextHalfHour() {
    DateTime next = DateTime.now();
    next = next.minusMillis(next.getMillisOfSecond());
    next = next.minusSeconds(next.getSecondOfMinute());

    if (next.getMinuteOfHour() > 30) {
      next = next.minusMinutes(next.getMinuteOfHour());
      next = next.plusMinutes(60);
    } else {
View Full Code Here

    if (start == null) {
      // set start to current time, rounded to hours
      DateTime startDate = DateTime.now();
      startDate = startDate.plusHours(1);
      startDate = startDate.minusMinutes(startDate.getMinuteOfHour());
      startDate = startDate.minusSeconds(startDate.getSecondOfMinute());
      startDate = startDate.minusMillis(startDate.getMillisOfSecond());
      start = startDate.toString();
    }
    ObjectNode startObj = JOM.createObjectNode();
    startObj.put("dateTime", start);
View Full Code Here

   * @return
   */
  private DateTime getNextHalfHour() {
    DateTime next = DateTime.now();
    next = next.minusMillis(next.getMillisOfSecond());
    next = next.minusSeconds(next.getSecondOfMinute());

    if (next.getMinuteOfHour() > 30) {
      next = next.minusMinutes(next.getMinuteOfHour());
      next = next.plusMinutes(60);
    } else {
View Full Code Here

        if (start == null) {
            // set start to current time, rounded to hours
            DateTime startDate = DateTime.now();
            startDate = startDate.plusHours(1);
            startDate = startDate.minusMinutes(startDate.getMinuteOfHour());
            startDate = startDate.minusSeconds(startDate.getSecondOfMinute());
            startDate = startDate.minusMillis(startDate.getMillisOfSecond());
            start = startDate.toString();
        }
        ObjectNode startObj = JOM.createObjectNode();
        startObj.put("dateTime", start);
View Full Code Here

    @Test
    public void compare()
    {
        DateTime now = new DateTime();
        Time cut = td.newTime(now);
        Time past = td.newTime(now.minusSeconds(1));
        Time future = td.newTime(now.plusSeconds(1));

        assertEquals(0, cut.compareTo(cut));
        assertTrue(cut.compareTo(future) < 0);
        assertTrue(cut.compareTo(past) > 0);
View Full Code Here

    @Test
    public void beforeAfter()
    {
        DateTime now = new DateTime();
        Date past = now.minusSeconds(1).toDate();
        Date future = now.plusSeconds(1).toDate();

        // before
        Time cut = new Time(null);
        assertFalse(cut.before(null));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.