Parses the default style of the {@link DateFormat} from context labels.

@param args The arguments of the macro.

@return The id of the style.
540325
private int parseDateFormatStyle(Arguments args)
    {
        if (args.has(SHORT_STYLE))
        {
            return DateFormat.SHORT;
        }
        else if (args.has(MEDIUM_STYLE))
        {
            return DateFormat.MEDIUM;
        }
        else if (args.has(LONG_STYLE))
        {
            return DateFormat.LONG;
        }
        else if (args.has(FULL_STYLE))
        {
            return DateFormat.FULL;
        }
        return DateFormat.DEFAULT;
    }
170021
public static String formatDate(Date argDate, String argFormat) throws Exception {
        if (argDate == null) {
            throw new Exception("参数[日期]不能为空!");
        }
        if (argFormat == null || argFormat.length() == 0) {
            argFormat = Y_M_D;
        }
        SimpleDateFormat sdfFrom = new SimpleDateFormat(argFormat);
        return sdfFrom.format(argDate).toString();
    }
783392
private ZonedDateTime parseDateTime(MessageArg arg) {
    long instant = arg.asLong();
    ZoneId timeZone = arg.timeZone() != null ? arg.timeZone() : this.timeZone;
    return ZonedDateTime.ofInstant(Instant.ofEpochMilli(instant), timeZone);
  }
868060
public static I_CmsListFormatter getDefaultDateFormatter() {

        return new CmsListDateMacroFormatter(
            Messages.get().container(Messages.GUI_LIST_DATE_FORMAT_1),
            Messages.get().container(Messages.GUI_LIST_DATE_FORMAT_NEVER_0));
    }
294796
public String formatAsString(final String formatPattern, final Date value) {
        return format(formatPattern, value).getText();
    }
199606
public String getFormattedDate(String format) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        return dateFormat.format(date);
    }
905415
public String format( String key, Object[] args )
    {
        try
        {
            String pattern = getPatternString( key );
            StringBuffer buff = new StringBuffer( key.length() + SPAN );
            MessageFormat messFormat = new MessageFormat( pattern, m_locale );
            messFormat.format( args, buff, null );
            String result = buff.toString();
            buff.setLength( 0 );
            return result;
        }
        catch( MissingResourceException mre )
        {
            StringBuffer sb = new StringBuffer();
            sb.append( "Unknown resource. Bundle: '" );
            sb.append( m_baseName );
            sb.append( "' Key: '" );
            sb.append( key );
            sb.append( "' Args: '" );

            for( int i = 0; i < args.length; i++ )
            {
                if( 0 != i )
                {
                    sb.append( "', '" );
                }
                sb.append( args[ i ] );
            }

            sb.append( "' Reason: " );
            sb.append( mre );

            return sb.toString();
        }
    }
516326
public CommandLine parseString(String commandName, String args) {
        // Steal ants implementation for argument splitting. Handles quoted arguments with " or '.
        // Doesn't handle escape sequences with \
        String[] argArray = translateCommandline(args);
        DefaultCommandLine cl = createCommandLine();
        cl.setCommandName(commandName);
        parseInternal(cl, argArray, false);
        return cl;
    }
570951
public static void main(String[] args) {
		Date date = parseDate("2018/01/07 12:11:10", "yyyy/MM/dd HH:mm:ss");
		Date date2 = parseDate("2018/01/07 16:12:15", "yyyy/MM/dd HH:mm:ss");
		System.out.println(date);
		System.out.println(date2);
		System.out.println(getHoursDifference(date, date2));
	}
663874
public static String format(final String pattern, final Locale locale, final Object... arguments) {
		MessageFormat format = new MessageFormat(pattern, locale);
		return format.format(arguments);
	}
50027
public static String format(String pattern, Object... arguments) {
        String msg = pattern;
        if (arguments != null) {
            for (int index = 0; index < arguments.length; index++) {
                msg = msg.replaceAll("\\{" + (index + 1) + "\\}", String.valueOf(arguments[index]));
            }
        }
        return msg;
    }
455296
public String asText(DateStyle dateStyle) {
		DateStyle prevStyle = this.style;
		
		checkNotNull(dateStyle).setLocale(prevStyle.locale());
		dateStyle.setFormatSymbols(prevStyle.formatSymbols());
		String dayText = with(dateStyle).asText();
		with(prevStyle);
		return dayText;
	}
737817
protected String internalFormatMessage(String pattern, Object[] args) {
        /* todo: perf -- could the MessageFormat objects be cached? */
        MessageFormat format = new MessageFormat(pattern);
        String msg = format.format(args).toString();
        return msg;
    }
1337993
public void generate( String... args ) {
        Format format = ConfigOptionParser.getFormat( args );
        switch( format ) {
            case ASCIIDOC:
                new AsciiDocReportGenerator().generateFromCommandLine( args );
                break;
            case TEXT:
                new PlainTextReportGenerator().generateFromCommandLine( args );
                break;
            case HTML:
            case HTML5:
            default:
                ReportGenerator.generateHtml5Report().generateFromCommandLine( args );
                break;
        }
    }
1030908
public static String formatDateTime(final int dateStyle, final int timeStyle, final Date value)
    {
        return context.get().formatDateTime(dateStyle, timeStyle, value);
    }
1349164
@SuppressWarnings({"UnusedDeclaration"})
    public static void main(String[] args){
        Syntax syntax = new Syntax();

        Matcher Q               = syntax.add("Q",              ch('\''));
        Matcher DIGIT           = syntax.add("DIGIT",          range("0-9"));
        Matcher PUBID_CHAR     = syntax.add("PUBID_CHAR",   or(any(" \r\n"), range("A-Z"), range("a-z"), DIGIT, any("-'()+,./:=?;!*#@$_%")));
        Matcher PUBID_CHAR_NQ     = syntax.add("PUBID_CHAR_NQ",   minus(PUBID_CHAR, Q));
        Matcher SPECIAL_CHAR     = syntax.add("SPECIAL_CHAR",   any("^[]-^&\\<"));
        Matcher NON_SPECIAL_CHAR = syntax.add("NON_SPECIAL_CHAR",   not(SPECIAL_CHAR));


//        Matcher GT              = syntax.add("GT",             ch('>'));
//        Matcher BRACKET_CLOSE   = syntax.add("BRACKET_CLOSE",  ch(']'));
//        Matcher DQ              = syntax.add("DQ",             ch('"'));

//        Matcher HEX_DIGIT       = syntax.add("HEX_DIGIT",      or(DIGIT, range("a-f"), range("A-F")));
//        Matcher WS              = syntax.add("WS",             any(" \t\n\r"));
//        Matcher ENCODING_START  = syntax.add("ENCODING_START", or(range("A-Z"), range("a-z")));
//        Matcher ENCODING_PART   = syntax.add("ENCODING_PART",  or(ENCODING_START, DIGIT, any("._-")));
//        Matcher CHAR            = syntax.add("CHAR",           or(any("\t\n\r"), range(" -\uD7FF"), range("\uE000-\uFFFD")/*, range("\u10000-\u10FFFF")*/));
//        Matcher DASH            = syntax.add("DASH",           ch('-'));
//        Matcher NDASH           = syntax.add("NDASH",          minus(CHAR, ch('-')));
//        Matcher NAME_START      = syntax.add("NAME_START",     or(ch(':'), range("A-Z"), ch('_'), range("a-z"), range("\u00C0-\u00D6"), range("\u00D8-\u00F6"), range("\u00F8-\u02FF"), range("\u0370-\u037D"), range("\u037F-\u1FFF"), range("\u200C-\u200D"), range("\u2070-\u218F"), range("\u2C00-\u2FEF"), range("\u3001-\uD7FF"), range("\uF900-\uFDCF"), range("\uFDF0-\uFFFD")/*, range("\u10000-\uEFFFF")*/));
//        Matcher NAME_PART       = syntax.add("NAME_PART",      or(NAME_START, ch('-'), ch('.'), DIGIT,  ch('\u00B7'), range("\u0300-\u036F"), range("\u203F-\u2040")));
//        Matcher NCNAME_START    = syntax.add("NCNAME_START",   minus(NAME_START, ch(':')));
//        Matcher NCNAME_PART     = syntax.add("NCNAME_PART",    minus(NAME_PART, ch(':')));

//        Rule rule = new Rule();
//        rule.node = new Node();
//        syntax.add("Rule1", rule);

        NBLREditor editor = new NBLREditor(syntax);
        editor.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        editor.setVisible(true);
    }
822190
public static function parseMaterialDesignIconicFontIcon(array $args) {

        $icon = static::newMaterialDesignIconicFontIcon();

        $icon->setName(ArrayHelper::get($args, "name", "home"));
        $icon->setStyle(ArrayHelper::get($args, "style"));

        $icon->setBorder(ArrayHelper::get($args, "border", false));
        $icon->setFixedWidth(ArrayHelper::get($args, "fixedWidth", false));
        $icon->setFlip(ArrayHelper::get($args, "flip"));
        $icon->setPull(ArrayHelper::get($args, "pull"));
        $icon->setRotate(ArrayHelper::get($args, "rotate"));
        $icon->setSize(ArrayHelper::get($args, "size"));
        $icon->setSpin(ArrayHelper::get($args, "spin"));

        return $icon;
    }