Welcome to Tedhi - the new date and date range parser for Java that beats everything else in user simplicity.
Examples of date supported are:
- 1/Nov/2012, 1/11/2012, 1/11/12
- Nov/2012, 11/2012 (defaults to 1st of month)
- 2012 (defaults to 1st of Jan)
- 7/Nov, 7/11, Nov (defaults to current year)
Examples of date ranges supported are:
- 1/Nov/2012 to 30/Nov/2012 (start of 1st to end of 30th)
- from 1/Nov/2012 to 30/Nov/2012 (same as above)
- Nov/2012 to Dec (start of 1/Nov/2012 to end of 31/Dec/2012)
- Aug to Mar/2013 (start of 1/Aug/2012 to end of 31/Mar/3013)
- 2012 to 2013 (start of 1/Jan/2012 to end of 31/Dec/2012)
- Nov (start of 1/Nov this year, to end of 30/Nov this year)
- after 10/Jan, before 15/Jan (start of 11/Jan to end of 15/Jan, this year)
Create formatter instances easily with any of the following methods or their locale specific variants:
- getDateInstance() - default for the locale
- getDateInstance(int style) - using java.text.DateFormat styles: FULL, LONG, MEDIUM, SHORT
- getInstance(String pattern) - using the date pattern from java.text.SimpleDateFormat
Date Range Syntax
Date ranges are from a date to another date, but are optionally open-ended at either one or both ends. Date ranges may be specified using inclusive or exclusive syntax, and in fact the two can be mixed together.
The basic forms of date ranges are as follows:
- from <start-date> to <end-date> - inclusive date range, "from" is optional
- after <start-date>, before <end-date> - exclusive date range, comma (',') is optional and could alternatively be a semicolon (';')
- from <start-date> - open-ended inclusive date range
- to <start-date> - open-ended inclusive date range
- after <start-date> - open-ended exclusive date range
- before <start-date> - open-ended exclusive date range
- <partial-date< - inclusive date range according to the level at which the date is defined, ie: define to the day and the range covers that day; define to a month and the range covers that month; define to a year and the range covers that year;
Additionally:
- you can combine "from" with "before", and "after" with "to"
Including Tedhi in your Project
Maven: add the following to your pom:
<dependency>
<groupId>net.sourceforge.tedhi</groupId>
<artifactId>tedhi</artifactId>
<version>0.5</version>
</dependency>
Ant: add the following to your classpath:
Tedhi Sourceforge Summary
[The Psychology of Dates and Times]
[Wiki Tips]
Project Members: