Example usage for org.joda.time LocalTime plusMillis

List of usage examples for org.joda.time LocalTime plusMillis

Introduction

In this page you can find the example usage for org.joda.time LocalTime plusMillis.

Prototype

public LocalTime plusMillis(int millis) 

Source Link

Document

Returns a copy of this time plus the specified number of millis.

Usage

From source file:com.hotwire.selenium.desktop.us.results.AirResultsPage.java

License:Open Source License

public ArrayList<LocalTime> getDepartureDestinationTimesList() {
    ArrayList<LocalTime> destinationDepartureTimeList = new ArrayList<LocalTime>();
    for (WebElement departureDestinationTime : departureDestinationTimes) {
        if (departureDestinationTime.findElements(By.cssSelector(".time")).isEmpty()) {
            continue;
        }//from w  w w . j a v a  2 s  . com
        String text = departureDestinationTime.findElement(By.cssSelector(".time")).getText().trim();
        LocalTime localTime = LocalTime.parse(text, DateTimeFormat.shortTime());
        if (departureDestinationTime.findElements(By.cssSelector(".plusDay")).size() > 0) {
            int plusDays = new Integer(departureDestinationTime.findElement(By.cssSelector(".plusDay"))
                    .getText().trim().replaceAll("[^0-9]", "")).intValue();
            localTime = localTime.plusMillis(plusDays);
        }
        destinationDepartureTimeList.add(localTime);
    }
    return destinationDepartureTimeList;
}

From source file:org.killbill.clock.ClockUtil.java

License:Apache License

/**
 * The method will convert the provided LocalDate into an instant (DateTime).
 * The conversion will use a reference time that should be interpreted from a UTC standpoint.
 *
 * The the provided LocalDate overlaps with the present, the current point in time is returned (to make sure we don't
 * end up with future instant)./* w ww. j  a  va  2s. c om*/
 *
 * If not, we use both the provide LocalDate and LocalTime to return the DateTime in UTC
 *
 * @param inputDateInTargetTimeZone The input LocalDate as interpreted in the specified targetTimeZone
 * @param inputTimeInUTCTimeZone    The referenceTime in UTC
 * @param targetTimeZone            The target timeZone
 * @param clock                     The current clock
 * @return
 */
public static DateTime computeDateTimeWithUTCReferenceTime(final LocalDate inputDateInTargetTimeZone,
        final LocalTime inputTimeInUTCTimeZone, final DateTimeZone targetTimeZone, final Clock clock) {

    final Interval interval = inputDateInTargetTimeZone.toInterval(targetTimeZone);
    // If the input date overlaps with the present, we return NOW.
    if (interval.contains(clock.getUTCNow())) {
        return clock.getUTCNow();
    }
    // If not, we convert the inputTimeInUTCTimeZone -> inputTimeInTargetTimeZone, compute the resulting DateTime in targetTimeZone, and convert into a UTC DateTime:
    final LocalTime inputTimeInTargetTimeZone = inputTimeInUTCTimeZone
            .plusMillis(targetTimeZone.getOffset(clock.getUTCNow()));
    final DateTime resultInTargetTimeZone = new DateTime(inputDateInTargetTimeZone.getYear(),
            inputDateInTargetTimeZone.getMonthOfYear(), inputDateInTargetTimeZone.getDayOfMonth(),
            inputTimeInTargetTimeZone.getHourOfDay(), inputTimeInTargetTimeZone.getMinuteOfHour(),
            inputTimeInTargetTimeZone.getSecondOfMinute(), targetTimeZone);
    return resultInTargetTimeZone.toDateTime(DateTimeZone.UTC);
}