Rounding a DateTime to the nearest minute

2010-12-01 Thread Jaldhar H. Vyas
Is there a simple way to do this (i.e. 6:14:56 becomes 6:15:00, 6:14:07 becomes 6:14::00 etc.) or do I have to roll my own? -- Jaldhar H. Vyas jald...@braincells.com

Re: Rounding a DateTime to the nearest minute

2010-12-01 Thread Rick Measham
This works in my head: $dt-add( seconds = 30 )-truncate( to = 'minute' ); Cheers! Rick Measham On 01/12/2010, at 10:32 PM, Jaldhar H. Vyas jald...@braincells.com wrote: Is there a simple way to do this (i.e. 6:14:56 becomes 6:15:00, 6:14:07 becomes 6:14::00 etc.) or do I have to roll my

Re: Rounding a DateTime to the nearest minute

2010-12-01 Thread Jaldhar H. Vyas
On Thu, 2 Dec 2010, Rick Measham wrote: This works in my head: $dt-add( seconds = 30 )-truncate( to = 'minute' ); Wonderful! One thing I found out about my data after I wrote is that I need to round down if seconds = 30 exactly. So I just changed your code to add 29 seconds and now it

Computation time on 'contains' for SpanSets

2010-12-01 Thread Per-Olof Jensen
I've been running into the issue of having a SpanSet being incredibly slow when doing a -contains on a DateTime-now object. I've tried spreading the spanset into an array of spans. That becomes much faster, but only if there is no time zone set on those spans. The moment I put time zones on