On Sat, Apr 23, 2016 at 3:52 PM, Zefram <[email protected]> wrote:
> Eric Brine wrote:
> >I can't figure out how to search only down to the minute without causing
> it
> >to find the wrong answer on days with two midnights.
>
> In those fairly common cases, where DST ending causes time to jump back
> from 01:00 to 00:00, you want to consistently get the earlier midnight.
> This doesn't pose any real difficulty.
Indeed, finding the minute posed no difficulty.
The problem I had:
00:00:00 <--- I wanted this
00:00:04 <--- Starting from this
00:59:59
00:00:00 <--- I was getting this.
Switching from
$dt->truncate( to => 'minute' )
to
$dt->substract( seconds => $dt->second )
solved that problem.