Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: parsing date string

by OeufMayo (Curate)
on Apr 27, 2001 at 23:14 UTC ( #76235=note: print w/replies, xml ) Need Help??

in reply to parsing date string

Though Date::Manip is certainly able to do this kind of operations, I would not recommand using it. In fact neither the author of this module:
Is Date::Manip the one you should be using? In my opinion, the answer is no about 90% of the time. This sounds odd coming from the author of the software, but read on.
Date::Manip is written entirely in perl. It's the most powerful of the date modules. It's also the biggest and slowest.

There are plenty of specialized module in the Date::* hierarchy that can fill the bill. For instance, I would use Time::Local for this kind of job, but I'm sure one could find a better suited module (maybe Date::Format?). Anyway here's a stab at it:

use Time::Local; my $time1 = '010101112245'; my $time2 = '010101114556'; foreach ($time1, $time2){ my @t = $time1 =~ /(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/; @t = reverse @t; $_ = timelocal(@t); } print "Difference is: ", ($time1 -$time2), "\n";

Disclaimer: Code barely tested, not to be used to operate nuclear reactors.

my $OeufMayo = new PerlMonger::Paris({http => ''});</kbd>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://76235]
[Corion]: Meh. I think I have now the parts down that I want from a simple Javascript frontend for single-page- applications with a aPerl backend. But it seems that all Javascript templating modules either don't support two-way binding (which would be nice) or ...
[Corion]: ... don't support server-side precompilation (which means the client has to compile all templates to Javascript themselves), or are giant frameworks that expect to do everything (which is not what I want)
[Corion]: I feel that there is a talk somewhere in there, either about the structure and parts, or how I used several parts to get a complete whole.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2017-03-30 07:44 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (355 votes). Check out past polls.