The best solution I can find at present is as follows:

DateTimeZone zone = DateTimeZone.forID("America/Sao_Paulo");
YearMonthDay baseDate = new YearMonthDay(2006, 10, 15);
try {
   baseDate.toDateMidnight(zone);
} catch (IllegalArgumentException ex) {
   DateTime dt = baseDate.plusDays(1).toDateTimeAtMidnight(zone);
   long adjustedMillis = zone.previousTransition(dm.getMillis()) + 1;
   dt = new DateTime(adjustedMillis, zone);
}

hope this helps
Stephen


Anibal Maffioletti de Deus - LMS wrote:
> Stephen,
> 
>       I have talked to you some time ago, when we started using Joda-Time in 
> our project. Today we are facing a problem and I would like your suggestion 
> in the best approach to solve this: we need in a lot of places to convert a 
> YearMonthDay into an DateTime with the minimum possible value. Until now, we 
> used YearMonthDay.toDateTimeAtMidnight(DateTimeZone), but with a larger base 
> of data we facing a problem, when we convert an DST entering date Example: 
> 
> new 
> org.joda.time.YearMonthDay(2006,10,15).toDateMidnight(org.joda.time.DateTimeZone.forID("America/Sao_Paulo"))
> 
>       So, my question: what is the best approach to get the smaller possible 
> DateTime value for a given YearMonthDay (I believe the best solution is 
> receive a DateTime at 1h00m)?
> 
> []'s

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to