I use Chilkat String for parsing about everything, one of the neatest methods is the parseDateRfc3339 because in combination with some pre-parsing/pre-handling I standardize most all date formats thrown at me.
However I discovered a problem with parseDateRfc3339(), when the argument starts with a double digit value for the year (ie '0014-09-01') the method does not return empty, or fails, or anything. It returns a malformed "Date" object (typeName = "Date").
This object cannot be used for output, or can be used for anything causing a hard break.
I would hate to carveout a specific case for "starts with 00" because a date may actually be year 66.
According to my notes, the Date format, which in this case is the OLE automation date format, is a floating point value, counting days since midnight 30 December 1899. Hours and minutes are represented as fractional days. Maybe for date/time strings earlier than 30-Dec-1899 it should just return 0 (meaning the date is effectively clamped at the lower-bound).
I just occurred to me that based on Chilkat's reponse, the programmer could try casting the Date into a numeric value, then comparing to the numeric value of his own platform. If the numeric value is lower than the numeric value of his floor (and ceiling for that matter), then the date would be invalid.
Something like this:
dDate = ckString.parseDateRfc3339() fDate = castAsFloating(dDate) fFloor = castAsFloating("01/01/0100") 'this would be your minimum acceptable date if fDate < fFloor then INVALID
This is somewhat of a workaround but it at least is doable, in my case, I was able to successfully parse the date into a Double, and from there use math.
Your millage may vary as your platform/interpreter/compiler of choice may still not be able to handle the Date as returned by the ckString method.