I don't know how helpful this is, but back in the late 1990's,
Apple's WebObjects (WO) had an NSTimestampFormatter class that would
parse textual inputs to output an NSTimestamp object (subclass of the
java.sql.Timestamp), and would format an NSTimestamp object into
various forms of textual output based on your specification.
Actually, the current WO NSTimestampFormatter still does all that.
But the earlier version had a "natural language" option which would
allow an incredible variety of input text that it would convert to an
NSTimestamp object. I remember entering such things as today,
yesterday, tomorrow, next week, last week, next month, in three
hours, and so forth, and it would generally just do the job.
You might ask on the Apple WebObjects mailing list if anyone still
has a copy of the Java NSTimestampFormatter class. Of course, all
bets are off on whether it is still compatible and whether their
giving it to you is legal, even if you could get hold of a copy. In
any case, that's the only example that I've heard of which did that
in Java.
On Apr 30, 2007, at 9:31 PM, Jeff Martin wrote:
Does anyone know of a class or library that does "smart" date
parsing ("guessing" would be a better word)? A lot of programs,
like spreadsheets, are good at taking arbitrarily formatted date
strings and turning them into a good guess of the user's intent,
regardless of whether the user enters a partial date (missing
year), specifies month by number, name or abbreviation, adds
annoying modifiers like "th" (Feb 14th), or even does crazy things
like "today" or "yesterday". Even better if it takes a locale to
know if the date is likely MM/dd or dd/MM.
I know it's wishful thinking, but I thought I'd see if anyone has
heard of something like this in Java.
jeff
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/jerrywwalker%
40gmail.com
This email sent to email@hidden
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden