Package java.text

Examples of java.text.SimpleDateFormat.applyPattern()


    }

    public static String format(final Date date, final boolean lenient, final String conversionPattern) {
        SimpleDateFormat sdf = DATE_FORMAT.get();
        if (conversionPattern != null) {
            sdf.applyPattern(conversionPattern);
        }
        sdf.setLenient(lenient);
        return sdf.format(date);
    }
View Full Code Here


        return DateUtils.parseDate(source, SyncopeConstants.DATE_PATTERNS);
    }

    public static Date parseDate(final String source, final String conversionPattern) throws ParseException {
        SimpleDateFormat sdf = DATE_FORMAT.get();
        sdf.applyPattern(conversionPattern);
        sdf.setLenient(false);
        return sdf.parse(source);
    }

    public static Number parseNumber(final String source, final String conversionPattern) throws ParseException {
View Full Code Here

      if (dateParser == null) {
        dateParser = new SimpleDateFormat(format, Locale.US);
        dateParser.setTimeZone(GMT);
        dateParser.set2DigitYearStart(startDate);
      } else {
        dateParser.applyPattern(format);
      }
      try {
        return dateParser.parse(dateValue);
      } catch (ParseException pe) {
        // ignore this exception, we will try the next format
View Full Code Here

            String format = (String) formatIter.next();           
            if (dateParser == null) {
                dateParser = new SimpleDateFormat(format, Locale.US);
                dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
            } else {
                dateParser.applyPattern(format);                   
            }
            try {
                return dateParser.parse(dateValue);
            } catch (ParseException pe) {
                // ignore this exception, we will try the next format
View Full Code Here

            if (dateParser == null) {
                dateParser = new SimpleDateFormat(format, Locale.US);
                dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
                dateParser.set2DigitYearStart(startDate);
            } else {
                dateParser.applyPattern(format);                   
            }
            try {
                return dateParser.parse(dateValue);
            } catch (ParseException pe) {
                // ignore this exception, we will try the next format
View Full Code Here

      PeriodicityHandler periodicityHandler, List<String> missingReport) {
    if (missingReport != null) {
      if (periodicityHandler.isDateBased()) {
        String timeFormat = "yyyy-MM-dd'T'HH:mm:ss";
        SimpleDateFormat sdf = new SimpleDateFormat();
        sdf.applyPattern(timeFormat);
        Date d = new Date((long) incrTime);
        String result = sdf.format(d);
        // System.err.println("Creating a missing row " + result);
        missingReport.add(result);
      } else {
View Full Code Here

              datePart = dateParts[0];
              dateFormat = dateParts[1];
            }

            SimpleDateFormat sdf = new SimpleDateFormat();
            sdf.applyPattern(dateFormat);
            try {
              Date d = sdf.parse(datePart);
              m_skipList.add(d);
              continue;
            } catch (ParseException e) {
View Full Code Here

            if (dateParser == null) {
                dateParser = new SimpleDateFormat(format, Locale.US);
                dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
                dateParser.set2DigitYearStart(startDate);
            } else {
                dateParser.applyPattern(format);                   
            }
            try {
                return dateParser.parse(dateValue);
            } catch (ParseException pe) {
                // ignore this exception, we will try the next format
View Full Code Here

            String format = (String) formatIter.next();           
            if (dateParser == null) {
                dateParser = new SimpleDateFormat(format, Locale.US);
                dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
            } else {
                dateParser.applyPattern(format);                   
            }
            try {
                return dateParser.parse(dateValue);
            } catch (ParseException pe) {
                // ignore this exception, we will try the next format
View Full Code Here

        try
        {
          SimpleDateFormat dateFormat = new SimpleDateFormat(formatsIn[i], Locale.ENGLISH);
          dateFormat.setLenient(false);
          Date dt = dateFormat.parse(in);         
          dateFormat.applyPattern(formatOut);
          return dateFormat.format(dt);
        }
        catch (ParseException pe)
        {
        }
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.