in reply to Re: date to epoch
in thread date to epoch

I am new to perl.. Could you please give me a sample code ?

Replies are listed 'Best First'.
Re^3: date to epoch
by Ratazong (Monsignor) on Nov 15, 2011 at 09:17 UTC
    # assumption: yyyymmddhhmmss $date =~ /(....)(..)(..)(..)(..)(..)/; my $year = $1; my $month = $2; ... my $sec = $6;
    However consider using character-classes (e.g. \d for a digit) and checking if $date is really in in the expected format instead of this "quick and dirty" solution.

      I tired this one and got following error Can't locate Date/Calc.pm in @INC (@INC contains: D:/strawberry/perl/site/lib D:/strawberry/perl/vendor/lib D:/strawberry/perl/lib .)

        You need to install this module if you want to use it:

        cpan Date::Calc

        See also Installing Modules.

        20111221123526 is the format which I need to convert to epoch