On Tue Apr 15 22:19:13 2008, andrew@etc.gen.nz wrote:
Show quoted text> There are another couple of strings that it'd be nice if ParseDateString
> could handle:
>
> first day of last month
> first day of this month
>
> And so on...
I'm sorry, but these will not be added. Here is the reasoning...
As I was adding date parsing, initially I was doing only static dates
(i.e. today, Jan 12, etc.). I very quickly knew that I wanted to parse
dates that are best thought of as a date+delta or date+modification. So,
for example, "yesterday" is equivalent to "today - 1 day". "last friday"
is "today" modified to the previous Friday.
As I added them, I realized that the number of date+delta and
date+modification formats was huge. I then decided that I would
absolutely not add any date+delta/modification+delta/modification formats.
"first day of last month" is "today" modified to first day of the month
minus a delta of 1 month. So, nice as it might be, I am not going to add
them due to the added complexity that that would put in the date parsing
routines. They are already more complex than I would like.
BTW... the answer above actually implies that there was more planning
involved than there actually was. What REALLY happened was that someone
proposed a date format (similar to yours I believe) which was a date and
two modifications and I went to add it and realized that I would have to
make some large and fundamental changes to the parsing routine, so at
that point I sat down and thought through the procedure to figure out
what it was that would require such changes (adding a second
modification), and then it was a pretty quick step to realizing that the
number of potential formats would be exponentially larger than with only
a single modification, and at that point, I made the decision.
Anyway, thanks for the suggestion. Sorry I can't (or more accurately..
won't) help this time.