@SuppressWarnings("rawtypes")
  public static SingleColumnComparator createDateComparator(NumberName numberName, final Locale locale, boolean ascending, String defaultString) throws Exception
  {
    final String type="date";
    if (ascending)
    {
      if (defaultString.equals(""))
      {
        return new SingleColumnComparator(numberName,ascending,type,defaultString)
        {
          public Comparable generateKey(String[] parts) throws Exception
          {
            return new Long(getDateValue(parts,locale));
          }
        };
      }
      else
      {
        final Long defaultKey = new Long(DateFormat.getDateInstance(DateFormat.DEFAULT,locale).parse(defaultString).getTime());
        return new SingleColumnComparator(numberName,ascending,type,defaultString)
        {
          public Comparable generateKey(String[] parts) throws Exception
          {
            try
            {
              return new Long(getDateValue(parts,locale));
            }
            catch (Exception e)
            {
              return defaultKey;
            }
          }
        };
      }
    }
    else
    {
      if (defaultString.equals(""))
      {
        return new SingleColumnComparator(numberName,ascending,type,defaultString)
        {
          public Comparable generateKey(String[] parts) throws Exception
          {
            return new Long(-getDateValue(parts,locale));
          }
        };
      }
      else
      {
        final Long defaultKey = new Long(-DateFormat.getDateInstance(DateFormat.DEFAULT,locale).parse(defaultString).getTime());
        return new SingleColumnComparator(numberName,ascending,type,defaultString)
        {
          public Comparable generateKey(String[] parts) throws Exception
          {
            try
            {
              return new Long(-getDateValue(parts,locale));
            }
            catch (Exception e)
            {
              return defaultKey;
            }
          }
        };
      }
    }
  }