On 04/08/06, Benoit Xhenseval <[EMAIL PROTECTED]> wrote: > With the advent of LocalDate and LocalDateTime, I was wondering what is the > most efficient way to converting a Java Date to/from LocalDate or > LocalDateTime. > > Is it: > localDate.toDateMidnight().toDate()?
There is no guaranteed way to make this work, as midnight may not exist on DST changing days. However, this may be slightly more reliable: localDate.toDateMidnight(DateTimeZone.UTC).toDate() > localDate = new LocalDate(myJavaDate); Use this to avoid nasty time zone issues: localDate = LocalDate.fromDateFields(myJavaDate); > Since YearMonthDay and co are going to be deprecated at some point, I will > have a look at the hibernate contribution so that LocalDate/LocalDateTime > can also be stored in Hibernate, unless somebody has done it already (or is > nearly done...) Feel free to dive in. Nobody has done this yet, although it has been mentioned. > Thanks & regards from London (yes, the English one), and regards from just South of London :-) Stephen ------------------------------------------------------------------------- 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
