Package org.joda.time.format

Examples of org.joda.time.format.DateTimeFormatter.parseDateTime()


                        }
                    }

                    if (date != null && time != null) {
                        DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyyMMddHHmm");
                        pe.dateTime = dtf.parseDateTime(date + time);
                    } else if (date != null) {
                        DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyyMMdd");
                        pe.dateTime = dtf.parseDateTime(date);
                    } else if (time != null) {
                        DateTimeFormatter dtf = DateTimeFormat.forPattern("HHmm");
View Full Code Here


                    if (date != null && time != null) {
                        DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyyMMddHHmm");
                        pe.dateTime = dtf.parseDateTime(date + time);
                    } else if (date != null) {
                        DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyyMMdd");
                        pe.dateTime = dtf.parseDateTime(date);
                    } else if (time != null) {
                        DateTimeFormatter dtf = DateTimeFormat.forPattern("HHmm");
                        pe.dateTime = dtf.parseDateTime(time);
                    }
                    events.add(pe);
View Full Code Here

                    } else if (date != null) {
                        DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyyMMdd");
                        pe.dateTime = dtf.parseDateTime(date);
                    } else if (time != null) {
                        DateTimeFormatter dtf = DateTimeFormat.forPattern("HHmm");
                        pe.dateTime = dtf.parseDateTime(time);
                    }
                    events.add(pe);
                }

            } catch (Exception e) {
View Full Code Here

        // before slash
        char c = leftStr.charAt(0);
        if (c == 'P' || c == 'p') {
            period = periodParser.withParseType(getPeriodType(leftStr)).parsePeriod(leftStr);
        } else {
            DateTime start = dateTimeParser.parseDateTime(leftStr);
            startInstant = start.getMillis();
            parsedChrono = start.getChronology();
        }
       
        // after slash
View Full Code Here

            }
            period = periodParser.withParseType(getPeriodType(rightStr)).parsePeriod(rightStr);
            chrono = (chrono != null ? chrono : parsedChrono);
            endInstant = chrono.add(period, startInstant, 1);
        } else {
            DateTime end = dateTimeParser.parseDateTime(rightStr);
            endInstant = end.getMillis();
            parsedChrono = (parsedChrono != null ? parsedChrono : end.getChronology());
            chrono = (chrono != null ? chrono : parsedChrono);
            if (period != null) {
                startInstant = chrono.add(period, endInstant, -1);
View Full Code Here

        //logger.debug("Matching date: " + m.group());
        // this group represents a string in the format YYYY-MM-DD
        String dateString = m.group();
        // parse the string and return the Date
        return fmt.parseDateTime(dateString);
    }

    /**
     * Null-safe method that returns a new instance of a DateTime object rounded
     * downwards to the nearest year. Note that the nearest valid year is actually
View Full Code Here

  // / <param name="result">Resulting floating point number</param>
  // / <returns>True if the parse was successful, otherwise false</returns>
  public static boolean tryParseDate(String s, Date[] result) {
    try {
      DateTimeFormatter parser2 = ISODateTimeFormat.dateTimeParser();
      Date f = parser2.parseDateTime(s).toDate();
      result[0] = f;
      return true;
    } catch (IllegalArgumentException e) {
      return false;
    }
View Full Code Here

      // find the nearest alarm - take the current time from the Sonos System, not the system where openhab is running

      String currentLocalTime = getTime();
      DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");

      DateTime currentDateTime = fmt.parseDateTime(currentLocalTime);

      Duration shortestDuration = Period.days(10).toStandardDuration();
      SonosAlarm firstAlarm = null;

      for(SonosAlarm anAlarm : sonosAlarms) {
View Full Code Here

          logger.debug("Error parsing Integer");
        }
       
        try {     
          DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");
          finalStartTime = formatter.parseDateTime(startTime);
          LocalTime localDateTime = finalStartTime.toLocalTime();
          finalStartTime = localDateTime.toDateTimeToday();
         
           PeriodFormatter pFormatter= new PeriodFormatterBuilder()
             .appendHours()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.