Example usage for org.joda.time LocalDateTime getMinuteOfHour

List of usage examples for org.joda.time LocalDateTime getMinuteOfHour

Introduction

In this page you can find the example usage for org.joda.time LocalDateTime getMinuteOfHour.

Prototype

public int getMinuteOfHour() 

Source Link

Document

Get the minute of hour field value.

Usage

From source file:org.jadira.usertype.dateandtime.joda.AbstractMultiColumnDateTime.java

License:Apache License

@Override
protected DateTime fromConvertedColumns(Object[] convertedColumns) {

    LocalDateTime datePart = (LocalDateTime) convertedColumns[0];
    DateTimeZone offset = (DateTimeZone) convertedColumns[1];

    final DateTime result;

    if (datePart == null) {
        result = null;/* www.j  a v a 2s.com*/
    } else {
        result = new DateTime(datePart.getYear(), datePart.getMonthOfYear(), datePart.getDayOfMonth(),
                datePart.getHourOfDay(), datePart.getMinuteOfHour(), datePart.getSecondOfMinute(),
                datePart.getMillisOfSecond(), offset);
    }

    return result;
}

From source file:org.netxilia.api.utils.DateUtils.java

License:Open Source License

public static LocalDateTime toLocalDateTime(ReadablePartial partial, LocalDateTime fullDateTime) {
    if (partial instanceof LocalDateTime) {
        return (LocalDateTime) partial;
    }/*  www .j a  v a 2s . c  om*/
    if (partial instanceof LocalDate) {
        LocalDate d = (LocalDate) partial;
        return new LocalDateTime(d.getYear(), d.getMonthOfYear(), d.getDayOfMonth(),
                fullDateTime.getHourOfDay(), fullDateTime.getMinuteOfHour(), fullDateTime.getSecondOfMinute(),
                fullDateTime.getMillisOfSecond());
    }

    if (partial instanceof LocalTime) {
        LocalTime t = (LocalTime) partial;
        return new LocalDateTime(fullDateTime.getYear(), fullDateTime.getMonthOfYear(),
                fullDateTime.getDayOfMonth(), t.getHourOfDay(), t.getMinuteOfHour(), t.getSecondOfMinute(),
                t.getMillisOfSecond());
    }

    throw new IllegalArgumentException("The partial parameter has an unsupported class:" + partial.getClass());
}

From source file:org.pidome.server.services.macros.Macro.java

License:Apache License

/**
 * Returns the last occurrence of the actions taken.
 * @return //from www .  j a va2s.c  o  m
 */
public final String getLastOccurrence() {
    if (lastOccurrenceTime == 0) {
        return "Never";
    } else {
        DateTime dt = new DateTime(new Date(lastOccurrenceTime));
        LocalDateTime ldt = dt.toLocalDateTime();
        return TimeUtils.compose24Hours(ldt.getHourOfDay(), ldt.getMinuteOfHour()) + " "
                + TimeUtils.composeDDMMYYYYDate(ldt.getDayOfMonth(), ldt.getMonthOfYear(), ldt.getYear());
    }
}

From source file:propel.core.utils.ConversionUtils.java

License:Open Source License

/**
 * Converts a Joda LocalDateTime object to an XML Gregorian Calendar data type
 *///from  ww  w.  ja  v a 2  s .c o m
@Validate
public static XMLGregorianCalendar toXMLGregorianCalendar(@NotNull final LocalDateTime value)
        throws DatatypeConfigurationException {
    val gc = new GregorianCalendar(value.getYear(), value.getMonthOfYear() - 1, value.getDayOfMonth(),
            value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute());
    gc.set(Calendar.MILLISECOND, value.getMillisOfSecond());

    return DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
}

From source file:qunar.tc.qmq.delay.store.log.ScheduleOffsetResolver.java

License:Apache License

private static long minute(final LocalDateTime localDateTime) {
    return localDateTime.getMinuteOfHour();
}

From source file:siddur.solidtrust.azure.AzureConnector.java

private static Date toDate(LocalDateTime l) {
    Calendar c = Calendar.getInstance();
    c.set(Calendar.YEAR, l.getYear());
    c.set(Calendar.DAY_OF_YEAR, l.getDayOfYear());
    c.set(Calendar.HOUR_OF_DAY, l.getHourOfDay());
    c.set(Calendar.MINUTE, l.getMinuteOfHour());
    c.set(Calendar.SECOND, l.getSecondOfMinute());
    c.set(Calendar.MILLISECOND, l.getMillisOfSecond());
    return c.getTime();
}

From source file:uk.co.onehp.trickle.services.betfair.ScheduledServiceImpl.java

License:Open Source License

private String nextBetSchedule() {
    LocalDateTime nextBetTime = this.domainService.getNextBetTime();
    if (null == nextBetTime) {
        nextBetTime = new LocalDateTime().plusMinutes(1);
    }//from ww w .j  av a 2s .  c  o m
    String cron = String.format("%s %s %s %s %s ?", nextBetTime.getSecondOfMinute(),
            nextBetTime.getMinuteOfHour(), nextBetTime.getHourOfDay(), nextBetTime.getDayOfMonth(),
            nextBetTime.getMonthOfYear());
    return cron;
}

From source file:uk.co.onehp.trickle.services.betfair.ScheduledServiceImpl.java

License:Open Source License

private String nextBetPriceSchedule() {
    LocalDateTime nextBetTime = this.domainService.getNextBetTime();
    if (null == nextBetTime) {
        nextBetTime = new LocalDateTime().plusMinutes(1);
    } else {/*from   w  ww. j a v a  2s .c  om*/
        nextBetTime = nextBetTime.minusSeconds(this.upcomingBetsSeconds);
    }
    String cron = String.format("%s %s %s %s %s ?", nextBetTime.getSecondOfMinute(),
            nextBetTime.getMinuteOfHour(), nextBetTime.getHourOfDay(), nextBetTime.getDayOfMonth(),
            nextBetTime.getMonthOfYear());
    return cron;
}

From source file:uk.co.onehp.trickle.util.DateUtil.java

License:Open Source License

public static String toShortString(LocalDateTime localDateTime) {
    return String.format("%s %s %s:%s", localDateTime.toDateTime().monthOfYear().getAsShortText(),
            localDateTime.toDateTime().dayOfMonth().getAsText(), localDateTime.getHourOfDay(),
            localDateTime.getMinuteOfHour());
}

From source file:view.popups.shift.ShiftPanel.java

private void makeChange() {
    boolean inputError = false;

    LocalDateTime ldt = shift.getStartTime();

    //Nulstiller timer.
    ldt = ldt.minusHours(ldt.getHourOfDay());

    //Nulstiller minuttet.
    ldt = ldt.minusMinutes(ldt.getMinuteOfHour());

    shift.setStartTime(ldt);// w w w  .ja  va  2s  .co  m

    //Dernst skal det som der er indtastet i configpopuppen tilfjes til 
    //den nulstillede dato.
    int modifiedStartHour = checkInput(configPanel.gettStartHour(), inputError, 23, 0);
    if (modifiedStartHour == -1) {
        inputError = true;
    }

    int modifiedStartMinute = checkInput(configPanel.gettStartMinute(), inputError, 59, 0);
    if (modifiedStartMinute == -1) {
        inputError = true;
    }

    int modifiedEndHour = checkInput(configPanel.gettEndHour(), inputError, 23, 0);
    if (modifiedEndHour == -1) {
        inputError = true;
    }

    int modifiedEndMinute = checkInput(configPanel.gettEndMinute(), inputError, 59, 0);
    if (modifiedEndMinute == -1) {
        inputError = true;
    }

    //Dernst udregnes vagttiden, alts hvor mange timer og minutter
    //vagten tager fra starttidspunktet.
    if (!inputError) {
        shift.setHours(Hours.hours(modifiedEndHour - modifiedStartHour));
        shift.setMinutes(Minutes.minutes(modifiedEndMinute - modifiedStartMinute));
    }
}