Package org.joda.time

Examples of org.joda.time.LocalDate.toDateMidnight()


   

    public static long toMillis(int year, int monthOfYear, int dayOfMonth) {
        LocalDate d = new LocalDate(year, monthOfYear, dayOfMonth);
        return d.toDateMidnight().getMillis();
    }

    public static long toMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute) {
        LocalDateTime d = new LocalDateTime(year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute);
        return d.toDateTime().getMillis();
View Full Code Here


  }
 
  @Test
  public void timeZones() {
    LocalDate lt = new LocalDate(2000, 1, 1);
    DateMidnight dm = lt.toDateMidnight(DateTimeZone.UTC);
   
    Assert.assertEquals("2000-01-01T00:00:00.000Z", dm.toString());
  }
}
View Full Code Here

  }
 
  @Test
  public void canConvertDate_toGregorianCalendar() {
    LocalDate lt = new LocalDate(2000, 1, 2);
    DateMidnight dm = lt.toDateMidnight(DateTimeZone.UTC);
   
    XMLGregorianCalendar gc = XmlUtils.asXMLGregorianCalendar(dm.toDate());
    Assert.assertEquals("2000-01-02T00:00:00.000Z", gc.toXMLFormat());
  }
 
View Full Code Here

  }
 
  @Test
  public void canConvert_GregorianCalendar_toDate() {
    LocalDate lt = new LocalDate(2000, 1, 2);
    DateMidnight dm = lt.toDateMidnight(DateTimeZone.UTC);
   
    Date d = dm.toDate();
   
    XMLGregorianCalendar gc = XmlUtils.asXMLGregorianCalendar(d);
    Date dConv = XmlUtils.asDate(gc);
View Full Code Here

    @ExcludeIn({CUBRID, DERBY, HSQLDB, SQLITE, TERADATA})
    public void Date_Diff2() {
        TestQuery query = query().from(employee).orderBy(employee.id.asc());

        LocalDate localDate = new LocalDate(1970, 1, 10);
        Date date = new Date(localDate.toDateMidnight().getMillis());

        int years = query.singleResult(SQLExpressions.datediff(DatePart.year, date, employee.datefield));
        int months = query.singleResult(SQLExpressions.datediff(DatePart.month, date, employee.datefield));
        // weeks
        int days = query.singleResult(SQLExpressions.datediff(DatePart.day, date, employee.datefield));
View Full Code Here

            }
            LocalDate local = parser.parseLocalDate(str);
            if (local == null) {
                return null;
            }
            return local.toDateMidnight();
        default:
        }
        throw ctxt.wrongTokenException(jp, JsonToken.START_ARRAY, "expected JSON Array, Number or String");
    }
}
View Full Code Here

            }
            LocalDate local = parser.parseLocalDate(str);
            if (local == null) {
                return null;
            }
            return local.toDateMidnight();
        }
        throw ctxt.wrongTokenException(jp, JsonToken.START_ARRAY, "expected JSON Array, Number or String");
    }
}
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.