Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Counting pregnancy weeks

by ruoso (Curate)
on Jun 09, 2008 at 20:45 UTC ( #691094=CUFP: print w/ replies, xml ) Need Help??

As a few of you might know, my wife is pregnant, and one thing people that is expecting a child finds out is that keeping track of the week count is very hard... So a oneliner comes to hand...

perl -MDateTime -e '$i=DateTime->new(year => 2008,month => 3,day => 5) +;print "$_ ",$i->add(weeks => 1)->strftime(q{%d/%m}), $/ for 1..40'
daniel

Comment on Counting pregnancy weeks
Download Code
Re: Counting pregnancy weeks
by Limbic~Region (Chancellor) on Jun 09, 2008 at 22:52 UTC
Re: Counting pregnancy weeks
by svenXY (Deacon) on Jun 10, 2008 at 06:41 UTC
    Hi,
    congratulations and nice one ruoso++. You'll also find out that it is even harder to keep track of the weeks after the child has been born - your oneliner also does that nicely. Just put in the birthday.
    Regards,
    svenXY (whose son is now 30 weeks old)
Reaped: Re: Counting pregnancy weeks
by NodeReaper (Curate) on Jun 10, 2008 at 06:42 UTC
Re: Counting pregnancy weeks
by andreas1234567 (Vicar) on Jun 10, 2008 at 07:08 UTC
    Congratulations ruoso.

    My wife's expecting our second daughter late July. Off to buy baby clothes..

    --
    No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2015-07-06 06:29 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 (70 votes), past polls