DateFormat Class
Represents a date format.
Inheritance Hierarchy
SystemObject
  GroupDocs.Search.OptionsDateFormat

Namespace: GroupDocs.Search.Options
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 20.8
Syntax
public class DateFormat

The DateFormat type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyDateSeparator
Gets the date separator.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString
Returns a String that represents the current DateFormat.
(Overrides ObjectToString.)
Remarks
Examples
The example demonstrates a typical usage of the class.
C#
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";
string query = "daterange(2017-01-01 ~~ 2019-12-31)";

Index index = new Index(indexFolder); // Creating an index in the specified folder
index.Add(documentsFolder); // Indexing documents from the specified folder

SearchOptions options = new SearchOptions();
options.DateFormats.Clear(); // Removing default date formats
DateFormatElement[] elements = new DateFormatElement[]
{
    DateFormatElement.MonthTwoDigits,
    DateFormatElement.DateSeparator,
    DateFormatElement.DayOfMonthTwoDigits,
    DateFormatElement.DateSeparator,
    DateFormatElement.YearFourDigits,
};
// Creating a date format pattern 'MM/dd/yyyy'
DateFormat dateFormat = new DateFormat(elements, "/");
options.DateFormats.Add(dateFormat);

SearchResult result = index.Search(query, options); // Search in index
See Also