I know about Date::Manip, but it doesn't seem to be working properly
any other ways to deal with date conversions?
my %MonthToNumber =( 'Jan' => '01', 'Feb' => '02', 'Mar' => '03', 'Apr' => '04', 'May' => '05', 'Jun' => '06', 'Jul' => '07', 'Aug' => '08', 'Sep' => '09', 'Oct' => '10', 'Nov' => '11', 'Dec' => '12');my $date = 'Thu Aug 21 10:42:00 2008';$date =~ s|\w+\s(\w+)\s(\d+)\s\d+:\d+:\d+\s(\d+)|sprintf('%2.2d/%2.2d/%4.4d',$MonthToNumber{$1},$2,$3)|e;
There are a million ways to deal with strings in perl. Regex, packages, string manipulation, etc....
What if I want to do the opposite? instead of converting Thu Aug 21 10:42:00 2008 to 08/21/08, do 08/21/08 to the other format.I guess I will lose the time correct? because the time is not provided in that case.Thanks
Correct. You would have to either provide time from somewhere or hardcode it to something (try to avoid ambiguity of a 00:00:00 sort). Another thing you are missing in that "reversal" is year. How would your code know if that 2008,1908 or 1708 BC?