in reply to Re: checking dates in strings
in thread checking dates in strings

I would strongly advise you consider using an existing CPAN module, like Date::Manip. That way, you can:

  1. Avoid having to reinvent code that already exists
  2. Avoid getting bitten by the many special cases in date processing
  3. Easily update your program if you find you need to support more than this particular date format


And if you want to improve your understanding of date handling, looking at the source of existing modules is a good place to start.

Replies are listed 'Best First'.
Re: Re: Re: checking dates in strings
by pg (Canon) on Nov 11, 2002 at 03:10 UTC
    I fully agree with you. There is also another package we can use for this purpose, but less natural than your suggestion:
    use HTTP::Date qw(parse_date); my ($year, $month, $day, $hour, $$minute, $second, $timezone) = parse_ +date("11-12-2002"); print "year = $year\n"; print "month = $month\n"; print "day = $day\n";