Package org.joda.time

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


        buf = new StringBuilder();
        f.printTo(buf, dt.getMillis());
        assertEquals("Wed 2004-06-09T11:20:30+01:00", buf.toString());
       
        buf = new StringBuilder();
        ISODateTimeFormat.yearMonthDay().printTo(buf, dt.toLocalDate());
        assertEquals("2004-06-09", buf.toString());
       
        buf = new StringBuilder();
        try {
            ISODateTimeFormat.yearMonthDay().printTo(buf, (ReadablePartial) null);
View Full Code Here


  }

  @Test
  public void testIsSameMonthInYear_DateTimeAndLocalDate() {
    DateTime dateTime = new DateTime();
    assertTrue(isSameMonthInYear(dateTime, dateTime.toLocalDate()));
    assertFalse(isSameMonthInYear(dateTime, dateTime.toLocalDate()
        .plusMonths(1)));
    assertFalse(isSameMonthInYear(dateTime, dateTime.toLocalDate().plusYears(1)));
  }
View Full Code Here

  @Test
  public void testIsSameMonthInYear_DateTimeAndLocalDate() {
    DateTime dateTime = new DateTime();
    assertTrue(isSameMonthInYear(dateTime, dateTime.toLocalDate()));
    assertFalse(isSameMonthInYear(dateTime, dateTime.toLocalDate()
        .plusMonths(1)));
    assertFalse(isSameMonthInYear(dateTime, dateTime.toLocalDate().plusYears(1)));
  }

  @Test
View Full Code Here

  public void testIsSameMonthInYear_DateTimeAndLocalDate() {
    DateTime dateTime = new DateTime();
    assertTrue(isSameMonthInYear(dateTime, dateTime.toLocalDate()));
    assertFalse(isSameMonthInYear(dateTime, dateTime.toLocalDate()
        .plusMonths(1)));
    assertFalse(isSameMonthInYear(dateTime, dateTime.toLocalDate().plusYears(1)));
  }

  @Test
  public void testToLocalDate() {
    XMLGregorianCalendar cal = toXmlDate(new DateTime());
View Full Code Here

  public void insert(E event) {

    DateTime time = event.getTime();
    if (!isSameMonthInYear(event.getTime(), currentMonth)) {
      commit();
      currentMonth = time.toLocalDate();
    }

    IMerger<T> merger = getMerger();
    T element = getConverter().convert(event);
    for (S category : data) {
View Full Code Here

        buf = new StringBuilder();
        f.printTo(buf, dt.getMillis());
        assertEquals("Wed 2004-06-09T11:20:30+01:00", buf.toString());
       
        buf = new StringBuilder();
        ISODateTimeFormat.yearMonthDay().printTo(buf, dt.toLocalDate());
        assertEquals("2004-06-09", buf.toString());
       
        buf = new StringBuilder();
        try {
            ISODateTimeFormat.yearMonthDay().printTo(buf, (ReadablePartial) null);
View Full Code Here

            DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortDate());
            if (out == null) {
                return null;
            }
           
            return out.toLocalDate();
    } catch (Exception e) {
      throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_date"), value));
    }
  }
}
View Full Code Here

                }
                nextday = sessions.get(sessionIdx).day();
               
                days += naturalDaysBetween(prevday, nextday);
                workingDate = dt.plusDays(days);
            } while(calculator.isNonWorkingDay(workingDate.toLocalDate()) &&
                    workingDate.getMonthOfYear() == month);
           
            ++tradingDayCount;
        }
       
View Full Code Here

     * @return            the current date if it is a valid trading date
     *                    or the very next valid trading date.
     */
    public DateTime getSessionTradingDate(DateTime dt) {
        DateTime workingDate = new DateTime(dt);
        while(calculator.isNonWorkingDay(workingDate.toLocalDate()) ||
            !isWorkingDay(workingDate.toLocalDate())) {
            workingDate = workingDate.plusDays(1);
        }
        return workingDate;
    }
View Full Code Here

     *                    or the very next valid trading date.
     */
    public DateTime getSessionTradingDate(DateTime dt) {
        DateTime workingDate = new DateTime(dt);
        while(calculator.isNonWorkingDay(workingDate.toLocalDate()) ||
            !isWorkingDay(workingDate.toLocalDate())) {
            workingDate = workingDate.plusDays(1);
        }
        return workingDate;
    }
   
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.