DateFormat Class |
Namespace: GroupDocs.Search.Options
The DateFormat type exposes the following members.
Name | Description | |
---|---|---|
![]() | DateFormat(String, DateFormatElement) |
Initializes a new instance of the DateFormat class.
|
![]() | DateFormat(DateFormatElement, String) |
Initializes a new instance of the DateFormat class.
|
Name | Description | |
---|---|---|
![]() | DateSeparator |
Gets the date separator.
|
Name | Description | |
---|---|---|
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() | MemberwiseClone | (Inherited from Object.) |
![]() | ToString |
Returns a String that represents the current DateFormat.
(Overrides ObjectToString.) |
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