Example usage for org.joda.time Period plusMinutes

List of usage examples for org.joda.time Period plusMinutes

Introduction

In this page you can find the example usage for org.joda.time Period plusMinutes.

Prototype

public Period plusMinutes(int minutes) 

Source Link

Document

Returns a new period plus the specified number of minutes added.

Usage

From source file:com.planyourexchange.utils.DateUtils.java

License:Open Source License

public static Period sum(Period timeTotal, LocalTime... locatimes) {
    for (LocalTime time : locatimes) {
        timeTotal = timeTotal.plusHours(time.getHourOfDay());
        timeTotal = timeTotal.plusMinutes(time.getMinuteOfHour());
        timeTotal = timeTotal.plusSeconds(time.getSecondOfMinute());
    }//from w w w  . j av a 2 s.c  om
    return timeTotal;
}

From source file:org.jevis.application.unit.SampleRateNode.java

License:Open Source License

private void setPeriod(TextField field) {
    Period newPeriod = Period.ZERO;

    if (sliderMinutes.getValue() != 0) {
        newPeriod = newPeriod.plusMinutes((int) sliderMinutes.getValue());
    }/*w  ww.j a v  a2s .  c o m*/
    if (sliderSecounds.getValue() != 0) {
        newPeriod = newPeriod.plusSeconds((int) sliderSecounds.getValue());
    }
    if (sliderHours.getValue() != 0) {
        newPeriod = newPeriod.plusHours((int) sliderHours.getValue());
    }
    if (sliderMonth.getValue() != 0) {
        newPeriod = newPeriod.plusMonths((int) sliderMonth.getValue());
    }
    if (sliderWeek.getValue() != 0) {
        newPeriod = newPeriod.plusWeeks((int) sliderWeek.getValue());
    }

    field.setText(newPeriod.toString());
    _returnPeriod = newPeriod;
}

From source file:voldemort.store.readonly.mr.utils.HadoopUtils.java

License:Apache License

public static Period parsePeriod(String periodStr) {
    Matcher monthsFormat = Pattern.compile("[0-9][0-9]*M").matcher(periodStr);
    Matcher daysFormat = Pattern.compile("[0-9][0-9]*d").matcher(periodStr);
    Matcher hoursFormat = Pattern.compile("[0-9][0-9]*h").matcher(periodStr);
    Matcher minutesFormat = Pattern.compile("[0-9][0-9]*m").matcher(periodStr);

    Period period = new Period();
    while (monthsFormat.find()) {
        period = period.plusMonths(/*from w  w w.  j  ava 2 s  .c  o  m*/
                Integer.parseInt(monthsFormat.group().substring(0, monthsFormat.group().length() - 1)));
    }
    while (daysFormat.find()) {
        period = period
                .plusDays(Integer.parseInt(daysFormat.group().substring(0, daysFormat.group().length() - 1)));
    }
    while (hoursFormat.find()) {
        period = period.plusHours(
                Integer.parseInt(hoursFormat.group().substring(0, hoursFormat.group().length() - 1)));
    }
    while (minutesFormat.find()) {
        period = period.plusMinutes(
                Integer.parseInt(minutesFormat.group().substring(0, minutesFormat.group().length() - 1)));
    }

    return period;
}