Package org.joda.time

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


        //Determine the ValueType of the date/time column. Use the most specific column type possible
        final ValueType dateTimeColumnType;
        if (interval.isHasTimePart()) {
            //If start/end are the same day just display the time
            if (startDateTime.toDateMidnight().equals(endDateTime.toDateMidnight())) {
                dateTimeColumnType = ValueType.TIMEOFDAY;
            }
            //interval has time data and start/end are on different days, show full date time
            else {
                dateTimeColumnType = ValueType.DATETIME;
View Full Code Here


        }
       
        final LocalTime startTime = start.toLocalTime();
        final TimeDimension startTimeDimension = this.timeDimensionDao.getTimeDimensionByTime(startTime);

        final DateMidnight startDateMidnight = start.toDateMidnight();
        final DateDimension startDateDimension = this.dateDimensionDao.getDateDimensionByDate(startDateMidnight);
       
        return new AggregationIntervalInfo(interval, start, end, startDateDimension, startTimeDimension);
    }
View Full Code Here

public class DatastoreUtilTest extends BaseModelTest {

    @Test
    public void testCountOverDateRange() {
        DateTime now = DateTime.now();
        Date d3 = now.toDateMidnight().toDate();
        Date d2 = now.minusDays(1).toDateMidnight().toDate()
        Date d1 = now.minusDays(2).toDateMidnight().toDate()

        DailyUsageStats s1 = new DailyUsageStats(3L, 2L, 4L, 4L, d1);
        DailyUsageStats s2 = new DailyUsageStats(3L, 2L, 4L, 4L, d2);
View Full Code Here

            }
            DateTime whenRegistered = alumni.getRegisteredWhen();
            if (whenRegistered != null) {
                // long time =
                // whenRegistered.toLocalDate().toDateTimeAtStartOfDay().getMillis();
                long time = whenRegistered.toDateMidnight().getMillis();
                Integer count = registrationsByDay.get(time);
                registrationsByDay.put(time, count == null ? 1 : count + 1);
            }
        }
View Full Code Here

    public String getPresentationInterval() {
        final DateTime start = interval.getStart();
        final DateTime end = interval.getEnd();
        final DateMidnight dateMidnight = start.toDateMidnight();
        if (dateMidnight.equals(end.toDateMidnight())) {
            return String.format("%s : %s as %s", dateMidnight.toString(DATE_FORMAT), getTime(start), getTime(end));
        }
        return interval.toString();
    }
View Full Code Here

    public DateMidnight getDateDay() {
        final DateTime start = interval.getStart();
        final DateTime end = interval.getEnd();
        final DateMidnight dateMidnight = start.toDateMidnight();
        if (dateMidnight.equals(end.toDateMidnight())) {
            return dateMidnight;
        }
        return null;
    }
View Full Code Here

  Object parse(final String data) {
    try {
      final DateTimeFormatter parseFormat = DateTimeFormat.forPattern(ISO_FORMAT);
      final DateTime date = parseFormat.withZone(DateTimeZone.UTC).parseDateTime(data);
      final DateMidnight dateMidnight = date.toDateMidnight();
      return dateMidnight;
    } catch (final Exception ex) {
      log.error("Can't parse DateMidnight: " + data);
      return new DateMidnight();
    }
View Full Code Here

     * @return {@link Date}
     */
    public static Date getNextDayMidnightDate(){
        DateTime midNight = new DateTime();
        midNight = midNight.plusDays(1);
        final DateMidnight midnightDate  = midNight.toDateMidnight();
        return midnightDate.toDate();
    }

    /**
     * Retrieve before day midnight.
View Full Code Here

     * @return
     */
    public static Date getBeforeDayMidnightDate(){
        DateTime midNight = new DateTime();
        midNight = midNight.plusDays(-1);
        final DateMidnight midnightDate  = midNight.toDateMidnight();
        return midnightDate.toDate();
    }

    /**
     * Increase a day your date.
View Full Code Here

 
  @Test
  public void testUniqueFileMoveUserCount() {   
    //setup date stuff
    DateTime now = DateTime.now();
        Date d2 = now.toDateMidnight().toDate();
        Date d1 = now.minusDays(1).toDateMidnight().toDate()
       
    //create a file move for a user 1
    FileMove mv1 = new FileMove(key1(), "foo", "bar", false);
    mv1.when = d2;
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.