Converting Time/Date into epoch string

Converting Time/Date into epoch string

am 01.06.2007 20:42:36 von sunadmn

Hello all I have a file that I am parsing with a time/date in the
format of:

Mon May 14 10:19:46 EDT 2007

I want to take this and turn that into epoch does anyone have a good
way to do this quickly?


Thanks,
-Steve

Re: Converting Time/Date into epoch string

am 01.06.2007 21:28:33 von paduille.4061.mumia.w+nospam

On 06/01/2007 01:42 PM, sunadmn wrote:
> Hello all I have a file that I am parsing with a time/date in the
> format of:
>
> Mon May 14 10:19:46 EDT 2007
>
> I want to take this and turn that into epoch does anyone have a good
> way to do this quickly?
>
>
> Thanks,
> -Steve
>

use Date::Parse;
my $time = str2time('Mon May 14 10:19:46 EDT 2007');

You'd have to install the Date::Parse module first. It can be found on
CPAN and as part of some Linux distributions.

Re: Converting Time/Date into epoch string

am 01.06.2007 21:28:58 von Paul Lalli

On Jun 1, 2:42 pm, sunadmn wrote:
> Hello all I have a file that I am parsing with a time/date in the
> format of:
>
> Mon May 14 10:19:46 EDT 2007
>
> I want to take this and turn that into epoch does anyone have a good
> way to do this quickly?

Download the Date::Parse module from CPAN.
http://search.cpan.org/~gbarr/TimeDate-1.16/lib/Date/Parse.p m

$ perl -MDate::Parse -le'print str2time("Mon May 14 10:19:46 EDT
2007");'
1179152386

Paul Lalli

Re: Converting Time/Date into epoch string

am 01.06.2007 21:44:06 von sunadmn

On Jun 1, 3:28 pm, "Mumia W." +nos...@earthlink.net> wrote:
> On 06/01/2007 01:42 PM, sunadmn wrote:
>
> > Hello all I have a file that I am parsing with a time/date in the
> > format of:
>
> > Mon May 14 10:19:46 EDT 2007
>
> > I want to take this and turn that into epoch does anyone have a good
> > way to do this quickly?
>
> > Thanks,
> > -Steve
>
> use Date::Parse;
> my $time = str2time('Mon May 14 10:19:46 EDT 2007');
>
> You'd have to install the Date::Parse module first. It can be found on
> CPAN and as part of some Linux distributions.

Thank you all I knew it had to be simple.

-Steve

Re: Converting Time/Date into epoch string

am 01.06.2007 23:27:57 von paduille.4061.mumia.w+nospam

On 06/01/2007 02:44 PM, sunadmn wrote:
> On Jun 1, 3:28 pm, "Mumia W." > +nos...@earthlink.net> wrote:
>> use Date::Parse;
>> my $time = str2time('Mon May 14 10:19:46 EDT 2007');
>>
>> You'd have to install the Date::Parse module first. It can be found on
>> CPAN and as part of some Linux distributions.
>
> Thank you all I knew it had to be simple.
>
> -Steve
>

You're welcome.

You can search for modules like this on CPAN's site:
http://search.cpan.org/

Re: Converting Time/Date into epoch string

am 20.06.2007 22:33:29 von Asim Suter

Date::Manip module works very good for these kind of operations.

Check it out on CPAN.

my $start_date = "Mon May 14 10:19:46 EDT 2007" ; ( your input )

Something like the following should do what you want.

ParseDate($start_time);
my @FORMATS = ( "%s" ) ;
my $sec_start = UnixDate( $start_date, @FORMATS ) ;

Regards.
Asim Suter


"sunadmn" wrote in message
news:1180723356.048260.263600@m36g2000hse.googlegroups.com.. .
> Hello all I have a file that I am parsing with a time/date in the
> format of:
>
> Mon May 14 10:19:46 EDT 2007
>
> I want to take this and turn that into epoch does anyone have a good
> way to do this quickly?
>
>
> Thanks,
> -Steve
>