How to get a DateTime::SpanSet duration in seconds for doing math?
[email protected] (Andreas Isberg) Fri, 29 Nov 2013 12:59:41 +0100
| Newsgroups | perl.datetime |
|---|---|
| Message-ID | <CACCHp3jP+X3sEGSziBN020K6=OoCCkfNF18HvqtuTUkTiC4QJA@mail.gmail.com> |
Hi, I'm trying to find a way to perform math with the duration of a DateTime::SpanSet. I'd prefer it to be in seconds, but I can't find anything from it in the documentation. What I did find is that the DateTime module has a *subtract_datetime_absolute* function that would give me seconds and nanoseconds from two DateTime objects. So I guess one way to do this is to iterate over the entire DateTime::SpanSet, and for all DateTime::Span perform subtract_datetime_absolute for the start and end of it, and sum it all. I haven't tried this yet tho.. Would this approach work, or is there any other better way? Kind regards, Andreas Isberg Telefon: 072-588 91 95