List of usage examples for org.joda.time.format DateTimeFormatter parseLocalTime
public LocalTime parseLocalTime(String text)
From source file:name.martingeisse.admin.application.converter.LocalTimeConverter.java
License:Open Source License
@Override public LocalTime convertToObject(String value, Locale locale) { try {//w w w .j av a 2s . c o m DateTimeFormatter formatter = getFormatter(locale); return formatter.parseLocalTime(value); } catch (Exception e) { throw new ConversionException(e); } }
From source file:net.solarnetwork.node.hw.currentcost.CCDatum.java
License:Open Source License
/** * Secondary setter to set the time, to support both v1 and v2 message * format mapping.//from ww w. j a v a2s.c o m * * @param time * the time */ public void setLocalTime(String timeString) { LocalTime t = null; if (timeString != null && timeString.length() > 5) { // the XPath mapping can result in a time like ::14:14:27, due to supporting old/new XML if (timeString.startsWith(":")) { timeString = timeString.replaceAll("^:+", ""); } DateTimeFormatter dtf = DateTimeFormat.forPattern("HH:mm:ss"); t = dtf.parseLocalTime(timeString); } this.time = t; }
From source file:org.kalypso.ogc.sensor.util.TimestampHelper.java
License:Open Source License
/** * This function converts the timestamp text (e.g. 11:00) to a timestamp. * //from w w w . jav a2 s .com * @param timestampText * The timestamp text in UTC. * @return The timestamp in UTC. */ public static LocalTime parseTimestamp(final String timestampText) { /* Nothing to do. */ if (timestampText == null || timestampText.length() == 0) return null; /* Create the date time formatter. */ final DateTimeFormatter formatter = createDateTimeFormatter(); /* REMARK: This will use the UTC timezone. */ return formatter.parseLocalTime(timestampText); }
From source file:org.kuali.coeus.sys.framework.scheduling.util.Time24HrFmt.java
License:Open Source License
private void parseTime(String time) { final DateTimeFormatter fmt = ISODateTimeFormat.hourMinute(); final LocalTime localTime = fmt.parseLocalTime(time); hours = String.valueOf(localTime.getHourOfDay()); minutes = String.valueOf(localTime.getMinuteOfHour()); }