Package org.joda.time.format

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


        MutableDateTime mdt = new MutableDateTime(0, getLenientISOChronology());
        int pos = 0;
        if (str.startsWith("-")) {
            pos = 1;
        }
        int newPos = p.parseInto(mdt, str, pos);
        if (newPos == ~pos) {
            throw new IllegalArgumentException(str);
        }
        int millis = (int)mdt.getMillis();
        if (pos == 1) {
View Full Code Here


        // set time zone for client
        format = format.withZone(DateTimeZone.forTimeZone(zone));
        dt.setZone(DateTimeZone.forTimeZone(zone));
      }
      // parse date retaining the time of the submission
      format.parseInto(dt, value, 0);
      // apply the server time zone to the parsed value
      dt.setZone(getTimeZone());
      return dt.toDate();
    }
    else
View Full Code Here

        dt.setZone(DateTimeZone.forTimeZone(zone));
      }
      try
      {
        // parse date retaining the time of the submission
        int result = format.parseInto(dt, value, 0);
        if (result < 0)
        {
          throw new ConversionException(new ParseException("unable to parse date "
              + value, ~result));
        }
View Full Code Here

        MutableDateTime mdt = new MutableDateTime(0, getLenientISOChronology());
        int pos = 0;
        if (str.startsWith("-")) {
            pos = 1;
        }
        int newPos = p.parseInto(mdt, str, pos);
        if (newPos == ~pos) {
            throw new IllegalArgumentException(str);
        }
        int millis = (int)mdt.getMillis();
        if (pos == 1) {
View Full Code Here

            // so something like 2011-01-01 will include the full first day of 2011.
            // we also use 1970-01-01 as the base for it so we can handle searches like 10:12:55 (just time)
            // since when we index those, the base is 1970-01-01
            MutableDateTime dateTime = new MutableDateTime(1970, 1, 1, 23, 59, 59, 999, DateTimeZone.UTC);
            DateTimeFormatter parser = getDateTimeFormatterParser(dateTimeFormatter, timeZone);
            int location = parser.parseInto(dateTime, value, 0);
            // if we parsed all the string value, we are good
            if (location == value.length()) {
                return dateTime.getMillis();
            }
            // if we did not manage to parse, or the year is really high year which is unreasonable
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.