Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: A date calculation

by FunkyMonk (Chancellor)
on Dec 18, 2007 at 21:47 UTC ( [id://657750]=note: print w/replies, xml ) Need Help??


in reply to A date calculation

1123200 = 13 * 24 * 60 * 60, ie 13 days from now, 31st December 2007. You use strftime to print the year and month: 0712 and tag an 01 on the end: 071201.

It looks like your proglet is doing what you're telling it to do. Or, am I missing something?

Replies are listed 'Best First'.
Re^2: A date calculation
by crawfordr (Acolyte) on Dec 18, 2007 at 22:10 UTC
    Hello, Thanks for the response. I have a question, how do we get 13 * 24 * 60 * 60 from 1123200. I was not sure how that was done. Thanks.
      13*24*60*60 is (days * hours/day * minutes/hour * seconds/min). So your script is taking the current date/time, adding 13 days to it, and then printing the two digit month and year of that date/time. Since 13 days from now is still December 2007, you're getting 0712 (instead of the 0801 you evidently expected).
      time is in seconds, so he is just converting 1123200 seconds into days
      11123200 / 60 sec / 60 min / 24 hours = 13 days.
      Or 13 days * 24 hours * 60 min * 60 sec = 1123200 seconds.
      13 days * 24 hours * 60 minutes * 60 seconds = 1123200 seconds

      Now I know I'm missing something:(

        No. One takes 13 days and multiplies it by unity three times, leaving it unchanged. Here is how it goes:
        (13 d) (24 h/d) (60 m/h) (60 s/m) = 1123200 s

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-24 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found