use Time::Local; my $timestamp = "20011130053055"; # timestamp(14) my $epoch = &ConvertTimestamp14ToEpochSeconds($timestamp); print $timestamp; sub ConvertTimestamp14ToEpochSeconds { my ($timeStamp) = @_; my $unpackPattern = "a4 a2 a2 a2 a2 a2"; my @dateList = reverse unpack($unpackPattern, $timestamp); $dateList[4]--; $dateList[5] -= 1900; my $epochSeconds = timelocal(@dateList); return ($epochSeconds); } # ConvertTimestamp14ToEpochSeconds