On 2/2/10 Tue Feb 2, 2010 6:38 AM, "syd_p" <sydneypue...@yahoo.com> scribbled:
> Hi, > > I need to parse a date in the above format - it is actually the output > from redhat chage (which I have in a variable and is the expiry date > of a password. > > Need to compare with the current date calculate the number of days > difference. > > Not quite sure how to go about this - can someone help. You can parse the date string using a regular expression and form a unix date/time value using the timelocal function of the Time::Local module. You have to translate the month name into a month number. If you want to not re-invent anything, there are several date modules available on CPAN. For example, the Date::Manip module has the ParseDate($string) function, and the Date::Calc module has the Decode_Date_US and Decode_Date_EU functions. See the advice given by 'perldoc -q date'. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/