On Fri, Jun 20, 2008 at 11:07:47AM +0200, Dr.Ruud wrote: > Rick Measham schreef: > > P DD wrote: > > >> my $tom = ($now + DateTime::Duration->new(days => 1))-> > >> truncate(to => 'day'); > > > > Can I suggest this for neater code: > > my $tom = $dt->clone->add( days => 1 )->truncate( to => 'day' ); > > I seem to remember that adding 24 hours is safer than adding 1 day. > (to never land on a non-existing DT value)
Then my $tom = $dt->clone->truncate( to => 'day' )->add( days => 1 ); should be yet safer, in case you call it during a leap second ;-) Unless someone messes with the first second of a day, that is. Jost -- | Helft Spam ausrotten! HTML in Mail ist unhöflich. | | Postmaster, JAPH, manchmal Wahrsager am RZ der RUB | | Wahre Worte sind nicht gefällig, gefällige Worte sind nicht wahr.| | Lao Tse, Tao Te King 81 |
smime.p7s
Description: S/MIME cryptographic signature
