Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Converting to epoch time.

by Limbic~Region (Chancellor)
on Mar 30, 2005 at 15:23 UTC ( [id://443501]=note: print w/replies, xml ) Need Help??


in reply to Converting to epoch time.

TASdvlper,
Take a look at Time::Local. If you are sure your data is rigidly formatted as you describe, a simple regex and that module is all you need.
#!/usr/bin/perl use strict; use warnings; use Time::Local; print scalar localtime( epoch( '2005-03-28 12:00:00' ) ); sub epoch { my $stamp = shift; my($yr, $mon, $day, $hr, $min, $sec) = split /[ :-]/, $stamp; --$mon; return timelocal($sec, $min, $hr, $day, $mon, $yr); }

Cheers - L~R

Added code snippet after initial post

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://443501]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-24 07:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found