Gossamer Forum
Home : General : Perl Programming :

Seconds since the epoch, months and number of days

Quote Reply
Seconds since the epoch, months and number of days
Hi,

I was working on a global to extract records from a table which are timestamped. What I would like to do is determine date ranges. Now.. using days this is very easy to do since I can determine current time, and apply the 86400 * days formula to go back in time. However, this does not takes into account months with 30, 31 or 29 days.

What would be the proper way to determine a date range for timestamped records so I can create data ranges taking into consideration the number of days for each month, is there any function for this or do I have to manually celculate the number of days for each month in the past and adjust accordingly?
Quote Reply
Re: [jaltuve] Seconds since the epoch, months and number of days In reply to
GT::Date should be able to do this, I believe, or you can try Date::Calc.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Seconds since the epoch, months and number of days In reply to
Thanks Philip,

I used str2time to convert a regular date string to unixtime, once both strings were converted I was able to do a direct comparison of the timestamped records.