Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to subtract month without using module?

by sk (Curate)
on Jul 25, 2005 at 05:53 UTC ( [id://477693]=note: print w/replies, xml ) Need Help??


in reply to How to subtract month without using module?

This is quick and dirty

If possible use modules for tricky issues like date/time. You need to worry about daylight saving etc.

#!/usr/bin/perl my $sixmthb4= time() - ( 24 * 60 * 60 * 30.5 * 6); # assuming 30.5 da +ys on avg. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($six +mthb4); print ("Month = ", $mon +1, " Day = $mday, Year = ",$year+1900,"\n");

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (9)
As of 2024-04-18 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found