Generate a set of datetime patterns to accommodate variations in MPX files.

@param datePattern date pattern element
@param timePatterns time patterns
@return datetime patterns
775596
private List<String> generateDateTimePatterns(String datePattern, String[] timePatterns)
   {
      List<String> patterns = new ArrayList<String>();
      for (String timePattern : timePatterns)
      {
         patterns.add(datePattern + " " + timePattern);
      }

      // Always fall back on the date-only pattern
      patterns.add(datePattern);

      return patterns;
   }
841375
public static Date formatDate(Date orig, String... patterns) {
        String pattern = TIMESTAMP_PATTERN;
        if (patterns != null && patterns.length > 0
                && StringUtils.isNotBlank(patterns[0])) {
            pattern = patterns[0];
        }
        return parseDate(DateFormatUtils.format(orig, pattern));
    }
545096
private String[] getTimePatterns(ProjectProperties properties)
   {
      String[] result;
      char timesep = properties.getTimeSeparator();
      ProjectTimeFormat format = properties.getTimeFormat();

      if (format == null || format == ProjectTimeFormat.TWELVE_HOUR)
      {
         result = new String[]
         {
            "hh" + timesep + "mm a",
            "hh" + timesep + "mma"
         };
      }
      else
      {
         result = new String[]
         {
            "HH" + timesep + "mm",
            "HH",
         };
      }

      return result;
   }
655287
public static String format(ITemplate template, Date date, String pattern, Locale locale, String timezone) {
        if (null == date) throw new NullPointerException();
        RythmEngine engine = null == template ? RythmEngine.get() : template.__engine();
        DateFormat df =  (null == engine ? IDateFormatFactory.DefaultDateFormatFactory.INSTANCE : engine.dateFormatFactory()).createDateFormat(template, pattern, locale, timezone);

        return df.format(date);
    }
1166035
public void setJsonDatePattern(String datePattern) {
		if (StrKit.isBlank(datePattern)) {
			throw new IllegalArgumentException("datePattern can not be blank.");
		}
		JsonManager.me().setDefaultDatePattern(datePattern);
	}
1281423
public void setPattern(String patternType) {

        final PatternType type = PatternType.valueOf(patternType);
        if (type != m_model.getPatternType()) {
            removeExceptionsOnChange(new Command() {

                public void execute() {

                    EndType oldEndType = m_model.getEndType();
                    m_model.setPatternType(type);
                    m_model.setIndividualDates(null);
                    m_model.setInterval(getPatternDefaultValues().getInterval());
                    m_model.setEveryWorkingDay(Boolean.FALSE);
                    m_model.clearWeekDays();
                    m_model.clearIndividualDates();
                    m_model.clearWeeksOfMonth();
                    m_model.clearExceptions();
                    if (type.equals(PatternType.NONE) || type.equals(PatternType.INDIVIDUAL)) {
                        m_model.setEndType(EndType.SINGLE);
                    } else if (oldEndType.equals(EndType.SINGLE)) {
                        m_model.setEndType(EndType.TIMES);
                        m_model.setOccurrences(10);
                        m_model.setSeriesEndDate(null);
                    }
                    m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth());
                    m_model.setMonth(getPatternDefaultValues().getMonth());
                    if (type.equals(PatternType.WEEKLY)) {
                        m_model.setWeekDay(getPatternDefaultValues().getWeekDay());
                    }
                    valueChanged();
                }
            });
        }

    }
207022
public synchronized static String formatTime(final Time object, String pattern) {
		if (pattern == null || pattern.equals("")) {
			pattern = JKFormatUtil.DEFAULT_TIME_PATTERN;
		}
		return JKFormatUtil.getDateFormatter(pattern).format(object);
	}
984678
private static DateTimeFormatter createFormatterForPattern(String pattern) {
        if (pattern == null || pattern.length() == 0) {
            throw new IllegalArgumentException("Invalid pattern specification");
        }
        DateTimeFormatter formatter = cPatternCache.get(pattern);
        if (formatter == null) {
            DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
            parsePatternTo(builder, pattern);
            formatter = builder.toFormatter();
            if (cPatternCache.size() < PATTERN_CACHE_SIZE) {
                // the size check is not locked against concurrent access,
                // but is accepted to be slightly off in contention scenarios.
                DateTimeFormatter oldFormatter = cPatternCache.putIfAbsent(pattern, formatter);
                if (oldFormatter != null) {
                    formatter = oldFormatter;
                }
            }
        }
        return formatter;
    }
240163
public static String getFormattedDate(final Long lastQueryDate, final String datePattern) {
        return formatDate(lastQueryDate, null, datePattern);
    }
464714
public void setConversionPattern(final String conversionPattern) {
		this.conversionPattern = OptionConverter.convertSpecialChars(conversionPattern);
		head = createPatternParser(this.conversionPattern).parse();
	}
529203
public static String format(final ZonedDateTime self, String pattern) {
        return self.format(DateTimeFormatter.ofPattern(pattern));
    }
545824
public static Format getDateFormatter(final String pattern) {
		Format format = JKFormatUtil.formatMap.get(pattern);
		if (format == null) {
			format = new SimpleDateFormat(pattern);
			JKFormatUtil.formatMap.put(pattern, format);
		}
		return format;
	}
72262
public static Pattern readPattern(final DataInput pStream) throws IOException {
        // Get the data (8 bytes)
        byte[] data = new byte[8];
        pStream.readFully(data);
        return new BitMapPattern(data);
    }
1373374
protected DateFormat createFormatter(final Optional<XlsDateTimeConverter> converterAnno) {

        final boolean lenient = converterAnno.map(a -> a.lenient()).orElse(false);
        if(!converterAnno.isPresent()) {
            SimpleDateFormat formatter = new SimpleDateFormat(getDefaultJavaPattern());
            formatter.setLenient(lenient);
            return formatter;
        }

        final String pattern = getJavaPattern(converterAnno);

        final Locale locale = Utils.getLocale(converterAnno.get().locale());
        final TimeZone timeZone = converterAnno.get().timezone().isEmpty() ? TimeZone.getDefault()
                : TimeZone.getTimeZone(converterAnno.get().timezone());

        final SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale);
        formatter.setLenient(lenient);
        formatter.setTimeZone(timeZone);

        return formatter;
    }
48847
private Pattern createPattern(String smarts, IChemObjectBuilder builder) throws IOException {
        SmartsPattern ptrn = SmartsPattern.create(smarts, builder);
        ptrn.setPrepare(false); // avoid redoing aromaticity etc
        return ptrn;
    }
939619
public static String format(final LocalDate self, String pattern) {
        return self.format(DateTimeFormatter.ofPattern(pattern));
    }
186578
public static String format(final Date date, final String pattern) {
        return format(date, pattern, null, null);
    }