Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: converting from php

by cees (Curate)
on Nov 21, 2005 at 03:33 UTC ( #510347=note: print w/replies, xml ) Need Help??


in reply to converting from php

Here is a sample script that shows how to do this using the DateTime module. There are probably shorter ways of doing the same thing, but this shows you a small bit of the power of the DateTime module, which can do pretty much anything you ever want to do with dates.

#!/usr/bin/perl use strict; use warnings; use DateTime; use DateTime::Format::Strptime; my $formatter = DateTime::Format::Strptime->new( pattern => '%a, %d %b %Y' ); my $today = DateTime->now( formatter => $formatter ); my @days = (); foreach my $day (1..14) { push @days, $today->clone->add( days => $day ); } print join("\n", @days), "\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://510347]
help
Chatterbox?
[marioroy]: stevieb :)
[marioroy]: that is funny, made me smile. miss those days
[marioroy]: thank you, humor of the day stevieb++
[1nickt]: Sad that so much of our humour these days is dry, wry, gallows humor :-/
[1nickt]: One of the great human characteristics .... to laugh in the face of doom :-)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2017-03-26 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (315 votes). Check out past polls.