Re: Last Second of Day for the given date?

[email protected] (Bill Moseley)
Newsgroups perl.datetime
Message-ID <[email protected]>
On Thu, Mar 12, 2009 at 02:28:34PM -0500, Dave Rolsky wrote:
> On Thu, 12 Mar 2009, Bill Moseley wrote:
>
>> Is there a canonical approach, or is it something like:
>>
>> $dt->add( days => 1 )->truncate( to => 'day' )->subtract( seconds => 1 );
>
> That should work fine, _but_ if you're not in the floating timezone that  
> could land you on "second 60" every once in a while, and your dbms may 
> not like it.

Interesting.  It's a valid time, though, correct?

> If the unit of interval is days, I'd suggest simply defining an internval 
> as "from X (inclusive) to Y (non-inclusive)". That way both X and Y can 
> be plain old dates.

That's probably a safer approach.

-- 
Bill Moseley.
[email protected]
Sent from my iMutt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.