@Override public void setParameter(final String parameter) throws CrazyException { try { if (parameter.contains(" ")) value = CrazyLightPluginInterface.DATETIMEFORMAT.parse(parameter); else value = CrazyLightPluginInterface.DATEFORMAT.parse(parameter); } catch (final ParseException e) { throw new CrazyCommandParameterException(0, "Date (YYYY-MM-DD [hh:mm:ss])"); } }
// Date public static Date StringToDate(final String date, final Date defaultDate) { if (date == null) return defaultDate; try { return CrazyLightPluginInterface.DATETIMEFORMAT.parse(date); } catch (final ParseException e) { try { return OLDDATETIMEFORMAT.parse(date); } catch (final ParseException e1) { return defaultDate; } } }
public static String DateToString(final Date date) { return CrazyLightPluginInterface.DATETIMEFORMAT.format(date); }