        TemplateModel _getAsTemplateModel(Environment env)
                throws TemplateException
        {
            TemplateModel model = target.getAsTemplateModel(env);
            if (model instanceof TemplateDateModel) {
                Date date = EvaluationRules.getDate((TemplateDateModel) model, target, env);
                return new SimpleNumber(date.getTime());
            } else {
                Number num = EvaluationRules.getNumber(model, target, env);
                if (num instanceof Long) {
                    return model;
                }
                return new SimpleNumber(num.longValue());
            }
        }

        TemplateModel _getAsTemplateModel(Environment env)
                throws TemplateException
        {
            TemplateModel model = target.getAsTemplateModel(env);
            if (!(model instanceof TemplateNumberModel)
                    && model instanceof TemplateDateModel) {
                Date date = EvaluationRules.getDate((TemplateDateModel) model, target, env);
                return new SimpleNumber(date.getTime());
            } else {
                Number num = EvaluationRules.getNumber(model, target, env);
                if (num instanceof Long) {
                    return model;
                }
                return new SimpleNumber(num.longValue());
            }
        }
