Hi,
I'm new to Joda and try to get it adopted in our application.
Legacy code use to set the Date with time being at the last second of a day,
to ensure a consistant behavior when comparing "date only" time with this
date.
To make things clearer, legacy code is crippled with things like that:
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy")
cal.setTime(sdf.parse("01/01/2009"));
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
i'd like to offer a unique function to replace that, using Joda.
I've tried to use the minus(..) methods but to no avail.
Here's what I've tried:
new DateMidnight(2009,1,2).minus(1000);
Looking at the Java doc, I understand it should be exactly equal to
cal.getTime().
However the getDate() methods return January 1st, at Midnight.
Minus doesn't seem to do what it is supposed to.
Obviously I misused it.
Can any one explain me how to work it, and more generally maybe, the fastest
way to get the last second before midnight DateTime of a given day?
rgds,
Jean
--
View this message in context:
http://n2.nabble.com/Getting-the-last-second-of-a-day-with-Joda-tp4104106p4104106.html
Sent from the Joda-Interest mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest