Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Answer: How to get time in seconds from localtime(time) to next 21st date of the month?

( #47510=categorized answer: print w/ replies, xml ) Need Help??

Q&A > dates and times > How to get time in seconds from localtime(time) to next 21st date of the month? contributed by davorg

This sounds pretty simple to achieve without modules. I won't write the code, but here's how I'd do it.

Use time to get the current epoch seconds Use localtime to convert that to date/time If the date is greater than 21 then increment the month number end set the date to 21 and the time to 12am use Time::Local::timelocal to convert that time to epoch seconds Subtract that from your first number

Comment on Answer: How to get time in seconds from localtime(time) to next 21st date of the month?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2015-07-03 15:37 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 (53 votes), past polls