hmmm! interesting... i'll study it for the next release of the page.
thanks a lot :)
On Thu, Dec 07, 2000 at 07:07:47PM -0800, Joey Hess wrote:
> Domenico Andreoli wrote:
> > there is any regular expression that "safely" finds a date in a string?
>
> Perl's Date::Manip does a good job:
>
> joey@kite:~>perl -le 'use Date::Manip; while (<>) { chomp ; \
> print "> ".UnixDate(ParseDate($_), "%Y-%m-%d") }'
> Thu Dec 7 19:05:30 PST 2000
> > 2000-12-07
> last day of december
> > 2000-12-31
> december 25th, 2021
> > 2021-12-25
> today
> > 2000-12-07
> yesterday
> > 2000-12-06
> 15 days ago
> > 2000-11-22
> in 15 days
> > 2000-12-22
> in 2 months
> > 2001-02-07
> in 12 hours
> > 2000-12-08
> 4/11/76
> > 1976-04-11
> 1976-04-11
> > 1976-04-11
> 4/11/76
> > 1976-04-11
>
> Unfortunatly, it does not handle the format "4-11-76", of course that
> format is ambiguous anyway. Data::Parse can, though it misses some of
> the forms above:
>
> joey@kite:~>perl -le 'use Date::Parse; while (<>) { \
> print "> ".localtime(str2time($_)) }'
> 4-11-76
> > Sun Apr 11 00:00:00 1976
> today
> > Wed Dec 31 16:00:00 1969
>
> :-)
>
> --
> see shy jo
>
>
> --
> To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
-----[ Domenico Andreoli, aka cavok
--[ http://filibusta.crema.unimi.it/~cavok/gpgkey.asc
--[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50
Attachment:
pgpxCY1CZ2rLe.pgp
Description: PGP signature