The tutorial and instructions of the Tedhi Date and Date Range Parser framework
Tutorials and examples of using Tedhi Date and Date Range Parser
introduce
Tedhi Date and Date Range Parser are a Java date parsing framework to analyze text inputs in various date formats and convert them into the date objects in Java.It can process the date input of various languages including Chinese, and has flexible and intelligent resolution ability.
Install
To use Tedhi Date and Date Range Parser, you need to add it to your Java project.You can complete the installation through maven or manual download jar file.
Example 1: Analysis date
The following is an example to demonstrate how to use Tedhi Date and Date Range Parser framework parsing date.
import com.tedhi.date.DateParser;
public class DateParsingExample {
public static void main(String[] args) {
String datestring1 = "March 12, 2022";
String datestring2 = "Tomorrow";
String datestring3 = "Next month";
DateParser parser = new DateParser();
System.out.println (Parser.parsedate (dateString1)); // Output: 2022-03-12
System.out.println (Parser.parsedate (dateString2)); // Output: Tomorrow's Date
System.out.println (Parser.parsedate (DateString3)); // Output: The date of next month
}
}
In the above example, we first created an object of `DateParser.Then, we use the `PARSEDATETE" method to analyze the date string to the date object in Java.The output will be different according to the input date string, but they will be an effective date object.
Example 2: Analysis date range
The Tedhi Date and Date Range Parser framework also supports the scope of the parsing date.The following is an example to demonstrate how to analyze the scope of the date.
import com.tedhi.date.DateRangeParser;
public class DateRangeParsingExample {
public static void main(String[] args) {
String datengestring1 = "March 1, 2022 to March 12, 2022";
String datengestring2 = "Wednesday to Tuesday";
DateRangeParser parser = new DateRangeParser();
System.out.println (Parser.parsedaterange (daterangestring1)); // Output: 2022-03-01 to 2022-03-12
System.out.println (Parser.parsedaterange (daterangestring2)); // Output: last Wednesday to Tuesday
}
}
In the above example, we created an object of the `daterangeparser" and using the `PARSEDATERANGE" method to analyze the date range of the date to the date range object in Java.The output will provide a parsing date range.
Summarize
Tedhi Date and Date Range Parser framework is a powerful date parsing tool that can be used to analyze text input in various date formats.It can handle multiple languages including Chinese and provide intelligent and flexible analytical ability.By using this framework, you can easily convert the date string into an effective Java date object and get the required information.