List of usage examples for org.joda.time LocalTime parse
public static LocalTime parse(String str, DateTimeFormatter formatter)
From source file:aiai.ai.yaml.env.TimePeriods.java
License:Open Source License
private static TimePeriod asTimePeriod(String s) { final int idx = s.indexOf('-'); if (idx == -1) { throw new IllegalArgumentException("Wrong format of string for parsing: " + s + ". Must be in format [HH:mm - HH:mm] (without brackets)"); }//from w ww . ja v a 2s. co m //noinspection UnnecessaryLocalVariable TimePeriod period = new TimePeriod(LocalTime.parse(s.substring(0, idx).trim(), FORMATTER), LocalTime.parse(s.substring(idx + 1).trim(), FORMATTER)); return period; }
From source file:bravox.sistema.mensagens.MensagemQtdMaiorProduzida.java
public void retornaHora(String minutos) { // DateTimeFormatter format = DateTimeFormat.forPattern("HH:mm"); LocalTime hora = LocalTime.parse(minutos, DateTimeFormat.forPattern("HH:mm")); }
From source file:ca.ualberta.physics.cssdp.jaxb.LocalTimeAdapter.java
License:Apache License
public LocalTime unmarshal(String v) throws Exception { return LocalTime.parse(v, DateTimeFormat.forPattern("HH:mm")); }
From source file:com.ephemeraldreams.gallyshuttle.util.DateUtils.java
License:Apache License
/** * Parse a string time into a {@link Date} object. * * @param time String time to parse./*from w w w. j av a 2s. co m*/ * @return Date object with time. */ public static LocalDateTime parseToLocalDateTime(String time) { return LocalTime.parse(trimAndFormat(time), DATE_FORMAT).toDateTimeToday().toLocalDateTime(); }
From source file:com.google.maps.internal.LocalTimeAdapter.java
License:Open Source License
/** * Read a time from the Places API and convert to a {@link LocalTime} *//*w w w.j a va 2s. c o m*/ @Override public LocalTime read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { reader.nextNull(); return null; } if (reader.peek() == JsonToken.STRING) { DateTimeFormatter dtf = DateTimeFormat.forPattern("HHmm"); return LocalTime.parse(reader.nextString(), dtf); } throw new UnsupportedOperationException("Unsupported format"); }
From source file:com.hotwire.selenium.desktop.us.results.AirResultsPage.java
License:Open Source License
public ArrayList<LocalTime> getOriginDepartureTimeList() { ArrayList<LocalTime> originDepartureTimeList = new ArrayList<>(); for (WebElement originDepartureTime : originDepartureTimes) { if (originDepartureTime.findElements(By.cssSelector(".time")).isEmpty()) { continue; }//from w w w . ja v a 2 s . com String text = originDepartureTime.findElement(By.cssSelector(".time")).getText().trim(); originDepartureTimeList.add(LocalTime.parse(text, DateTimeFormat.shortTime())); } return originDepartureTimeList; }
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; }/* ww w . j a v a 2s .c o m*/ 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:com.mycompany.ajaxandxml.ws.LocalTimeAdapter.java
@Override public LocalTime unmarshal(String v) throws Exception { return LocalTime.parse(v, timeFormatter); }
From source file:com.qcadoo.mes.basic.shift.WorkingHours.java
License:Open Source License
private TimeRange stringToInterval(final String hoursRange) { String[] lowerUpperBound = StringUtils.split(hoursRange, '-'); LocalTime lower = LocalTime.parse(lowerUpperBound[0], TIME_FORMATTER); LocalTime upper = LocalTime.parse(lowerUpperBound[1], TIME_FORMATTER); return new TimeRange(lower, upper); }
From source file:com.sandata.lab.common.utils.date.DateUtil.java
License:Open Source License
/** * Parse a string of format "hh:mm aa" to <code>LocalTime</code> * * @param shortTime//from w ww . j a v a 2s .c o m * @return */ public static LocalTime parseShortTime(String shortTime) { return LocalTime.parse(shortTime, SANDATA_TIME_FORMATTER); }