Last Second of Day for the given date?

[email protected] (Bill Moseley)
Newsgroups perl.datetime
Message-ID <[email protected]>
Is there a canonical approach, or is it something like:

$dt->add( days => 1 )->truncate( to => 'day' )->subtract( seconds => 1 );


Here's the ugly part:

The deal is I have a web form where start and end dates are entered,
but in the database the column is a timestamp.  Typically, the
smallest interval is an entire day, but want to retain the ability to
use a custom time within the day.

So, instead of truncating in the database select (which would prevent
using a custom start or end time of day) the plan is to truncate the
DateTime objects before storing in the database.

So, in this form, the smallest interval possible is one day, so if the
same date is entered for both start and end then the interval is the
entire day.

Yes, a bit convoluted.


-- 
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.