public class DateFormat extends Object
Learn more
The example demonstrates a typical usage of the class.
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.getDateFormats().clear(); // Removing default date formats
DateFormatElement[] elements = new DateFormatElement[] {
DateFormatElement.getMonthTwoDigits(),
DateFormatElement.getDateSeparator(),
DateFormatElement.getDayOfMonthTwoDigits(),
DateFormatElement.getDateSeparator(),
DateFormatElement.getYearFourDigits(),
};
// Creating a date format pattern 'MM/dd/yyyy'
com.groupdocs.search.DateFormat dateFormat = new com.groupdocs.search.DateFormat(elements, "/");
options.getDateFormats().addItem(dateFormat);
SearchResult result = index.search(query, options); // Search in index
| Modifier | Constructor and Description |
|---|---|
protected |
DateFormat()
Initializes a new instance of the
DateFormat class. |
|
DateFormat(DateFormatElement[] formatElements,
String dateSeparator)
Initializes a new instance of the
DateFormat class. |
|
DateFormat(String cultureName,
DateFormatElement[] formatElements)
Initializes a new instance of the
DateFormat class. |
| Modifier and Type | Method and Description |
|---|---|
Object |
getCore() |
String |
getDateSeparator()
Gets the date separator.
|
String |
toString()
Returns a String that represents the current
DateFormat. |
protected DateFormat()
DateFormat class.public DateFormat(DateFormatElement[] formatElements, String dateSeparator)
DateFormat class.formatElements - The format elements.dateSeparator - The date separator.public DateFormat(String cultureName, DateFormatElement[] formatElements)
DateFormat class.cultureName - The culture name.formatElements - The format elements.Copyright © 2026. All rights reserved.