The string format is wrong. +01:00 refers to summer time, Z refers to
winter time.
I was suggesting that this might work:
DateTime preDST = new DateTime("2007-10-28T01:20:30+01:00");
DateTime postDST = new DateTime("2007-10-28T01:20:30Z");
Stephen
Paul Nolan wrote:
> Hi There,
>
> Based on our previous discussion, I am trying to get Joda to parse a
> time that lies in the hour of 01:00 to 02:00 on the 28th October 2007
> into a pre-changover time. The hours go BACK at 02:00 AM so I want to
> parse a time representing the pre changover time.
>
> DateTimeFormatter formatter =
> DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ssZZZZZZZZ");
> DateTime preDSTTime = formatter.parseDateTime("2007-10-28
> 01:20:30+01:00/Z");
>
> The above code does not work, it throws an exception.
>
> Is there a way I can do this? I tried parseInto also and it does not
> seem to work, it parses it into GMT and does not throw an exception.
>
> many thanks,
>
> - Paul.
>
> On 10/25/07, *Stephen Colebourne* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Parsing strings ignores the timezone string (IST/GMT).
> However, it can parse the +01:00/Z.
> I'm not sure what parsing will pick in this exact scenario, but you
> could try it with +01:00/Z.
>
> Stephen
>
>
> Paul Nolan wrote:
> > Hi Rodrigo,
> >
> > Thanks for the reply.
> >
> > I don't think there is anything wrong with it. I am just trying
> to see
> > if there is a way I can tell it to assume IST and not GMT since
> there
> > are 2 such times due to DST i.e .
> >
> > 1. 2007-10-28 01:20:00 IST and
> > 2. 2007-10-28 01:20:00 GMT.
> >
> > Is there a way I can do this using the DateTimeFormatter? e.g. is
> there
> > a way to do the following:
> >
> > DateTimeFormatter.parse("2007-10-28 01:20:00 IST") or perhaps
> > DateTimeFormatter.parse("2007-10-28 01:20:00 UTC+1")
> >
> > or something like that?
> >
> > thanks,
> >
> > - Paul.
> >
> > On 10/24/07, *Rodrigo de Avila * <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >> wrote:
> >
> > Hi Paul,
> >
> > Sorry, but, nothing wrong to me here:
> >
> > DateTime now = new DateTime(2007, 10, 28, 01, 20, 0, 0,
> > DateTimeZone.forID("Europe/Dublin") );
> >
> > out.println(now + " " + now.getZone()); //2007-10-28T01:20:
> 00.000Z
> > Europe/Dublin
> >
> > now = now.plusHours(1);
> >
> > out.println(now + " " + now.getZone());
> //2007-10-28T02:20:00.000Z
> > Europe/Dublin
> >
> > 1) What's the VM default timezone? GMT? If yes, you can
> change it to
> > Europe/Dublin using System.setProperty?
> >
> > 2) Do you update the TZ information in Joda-time jar file, to
> > recognize the summer time in Europe/Dublin? (I don't know if
> your ST
> > is fixed or not) Instructions you find in
> > http://joda-time.sourceforge.net/tz_update.html
> >
> > 3) Do you see the problem with now.plusHours(1) when you
> insert this
> > time in an database? If yes, remember: the DateTime class is
> > immutable; when you call new DateTime with parameters, only
> the fiels
> > are updated (year, month, day, hour, minute, second). The
> > getTimeInMillis is not updated. Use MutableDateTime instead.
> >
> >
> > 2007/10/24, Paul Nolan < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>>:
> > > Hi there,
> > >
> > > I live in Ireland. It is currently IST - Irish Summer Time.
> > >
> > > On the 28th October 2007 at 02:00 AM the clocks will go
> backwards
> > one hour
> > > to 01:00 AM GMT.
> > >
> > > So, in effect, there are two 01:01 AM's, two 01:02 AM's
> etc. One
> > in IST and
> > > one in GMT.
> > >
> > > My question is this:
> > >
> > > If I execute the code:
> > >
> > > DateTime now = new DateTime(2007, 10, 28, 01, 20,
> 0, 0,
> > > DateTimeZone.forID("Europe/Dublin") );
> > >
> > > It defaults to 01:20 GMT. So, naturally if I execute:
> > >
> > > now = now.plusHours(1);
> > >
> > > The time is now 02:20 GMT.
> > >
> > > How do I tell DateTime to assume IST? I tried with the
> time zone
> > ID "IST"
> > > but it is not recognised...I know these have been deprecated.
> > >
> > > In other words how do I do something like:
> > >
> > > DateTime now = new DateTime(2007, 10, 28, 01, 20,
> 0, 0,
> > > DateTimeZone.forID("IST") );
> > >
> > > To get: 01:20 IST
> > >
> > > now = now.plusHours(1);
> > >
> > > I get 01:20 GMT?
> > >
> > > thanks,
> > >
> > > - Paul.
> > >
> >
> -------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Splunk Inc.
> > > Still grepping through log files to find problems? Stop.
> > > Now Search log events and configuration files using AJAX and a
> > browser.
> > > Download your FREE copy of Splunk now >>
> http://get.splunk.com/ <http://get.splunk.com/>
> > > _______________________________________________
> > > Joda-interest mailing list
> > > [email protected]
> <mailto:[email protected]>
> > <mailto:[email protected]
> <mailto:[email protected]>>
> > > https://lists.sourceforge.net/lists/listinfo/joda-interest
> <https://lists.sourceforge.net/lists/listinfo/joda-interest>
> > >
> > >
> >
> >
> > --
> > Rodrigo de Avila
> > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> <mailto:
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> >
> > http://www.avila.eti.br
> >
> >
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and
> a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > <http://get.splunk.com/>
> > _______________________________________________
> > Joda-interest mailing list
> > [email protected]
> <mailto:[email protected]>
> > <mailto:[email protected]
> <mailto:[email protected]> >
> > https://lists.sourceforge.net/lists/listinfo/joda-interest
> >
> >
> >
> >
> ------------------------------------------------------------------------
>
> >
> >
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a
> browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Joda-interest mailing list
> > [email protected]
> <mailto:[email protected]>
> > https://lists.sourceforge.net/lists/listinfo/joda-interest
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/joda-interest
> <https://lists.sourceforge.net/lists/listinfo/joda-interest>
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest