Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^3: GMT to PST format

by Krambambuli (Curate)
on Jun 20, 2010 at 08:10 UTC ( #845605=note: print w/replies, xml ) Need Help??

in reply to Re^2: GMT to PST format
in thread GMT to PST format

If you can, install Date::Manip from CPAN. Otherwise, try a solution with one of the modules you have installed, maybe DateTime.

Replies are listed 'Best First'.
Re^4: GMT to PST format
by Anonymous Monk on Jun 20, 2010 at 08:32 UTC
    Date::Manip module is installed. But when I use the code
    #!/usr/bin/perl use strict; use warnings; use Date::Manip; my $date_manip_object = new Date::Manip; $date_manip_object->parse( '2 days ago' ); $date_manip_object->convert( 'GMT' ); my $gmt_ref = $date_manip_object->printf( '%Y%m%d') ; while (<DATA>) { my $err = $date_manip_object->parse_format('.*?\\[%d/%b/%Y:%T\s+%z +\\].*', $_); next if $err; # skip (?) lines that do not match the date format my $input_line_date = $date_manip_object->printf( '%Y%m%d') ; if ($input_line_date eq $gmt_ref) { print; } } __DATA__ - - [15/Jun/2010:23:30:34 +0000] - - - [16/Jun/2010:23:30:34 +0000] -
    Can't locate object method "new" via package "Date::Manip" at
      my $date_manip_object = new Date::Manip;

      Where in the documentation did you find that usage? It doesn't work because the module does not work that way. Read Date::Manip. - - [15/Jun/2010:23:30:34 +0000] - - - [16/Jun/2010:23:30:34 +0000] -
        The date and time is in GMT. I should convert to PST time.
        #!/usr/bin/perl use Date::Manip; $date = ParseDate("2 days ago"); print $date
        This works and why created a object doenst work.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://845605]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2018-06-22 00:46 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (120 votes). Check out past polls.