On 2 February 2012 13:15, Johannes Ulfkjær Jensen <sp...@cs.au.dk> wrote: > I am parsing a sequence of timestamps in Europe/Copenhagen like: > > 2009-10-25 01:00 > 2009-10-25 02:00 > 2009-10-25 02:00 > 2009-10-25 03:00 > 2009-10-25 04:00
These are not timestamps ;-) They are local representations of date and time. There is insufficient information in those strings to accurateyl parse the correct point in UTC. Whereas there is enough information here (and parser support for it) 2009-10-25 01:00+02:00 2009-10-25 02:00+02:00 2009-10-25 02:00+01:00 2009-10-25 03:00+01:00 > When DST ends, the clock is set one hour back and we have to identical > strings of that point in time. Currently I detect this with a bunch of > getZone().getOffset() and some plus/minusHours() calls and but it seems I > still need to know which of the offsets the DateTimeFormatter.parseDateTime > is going to choose on this overlap. Is this defined anywhere? The methods withEarlierOffset() and withLaterOffset() allow you to create the DateTime object and then adjust it if necessary afterwards. (Fix made in git today to the withLaterOffset() method. > Also, this seems quite messy. Is there any better way of going at it ? If you are inventing information out of thin air, then the code is necessarilty going to be messy! Stephen ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest