Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to subtract month without using module?

by Zaxo (Archbishop)
on Jul 25, 2005 at 05:35 UTC ( [id://477689]=note: print w/replies, xml ) Need Help??


in reply to How to subtract month without using module?

. . . without using any module.

Who is handicapping you in this way? Do they have any stake in the result?

You'll have to decide whether six months have 182 or 183 days (or 182.62). I'll show two ways of getting a readable time.

my $before_time = time() - 183 * 24 * 60 * 60; print scalar localtime $before_time; use POSIX 'strftime'; print strftime "\n%D\n", localtime $before_time;
The POSIX::strftime() method is the more flexible, so pick it if requirements tend to slip around.

After Compline,
Zaxo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-19 01:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found