Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: days between dates

by vagabonding electron (Hermit)
on Mar 16, 2013 at 15:35 UTC ( #1023829=note: print w/ replies, xml ) Need Help??


in reply to days between dates

Yet another option could be with Time::Piece (a core module now):

#!/usr/bin/perl use strict; use warnings; use Time::Piece; my $datf = Time::Piece->strptime("1/1/1904", "%d/%m/%Y"); my $datt = Time::Piece->strptime("5/3/2013", "%d/%m/%Y"); my $diff = $datt - $datf; my $result = $diff->days + 1462; print "$result days\n";
This prints "41338 days".


Comment on Re: days between dates
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (21)
As of 2015-07-06 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (80 votes), past polls