DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

Colin Yates
Today my tests started to fail even though I haven't changed anything for weeks (first day back after a period of illness).  I have isolated the problem to the fact that when I call DateTime.toDateMidnight() it *sometimes* changes the offset from '+01:00' to 'Z'.  

As an experienced programmer, the first thing I would be thinking after reading this is "muppet must be doing something stupid" only I don't think I am :).

The following (groovy) snippet exhibits this behaviour:

--- start
    @Test
    public void silly() {
        def days = 20
        DateMidnight now = new DateTime()
        DateMidnight nowPlusDays = now.toDateTime().plusDays(days).toDateMidnight()

        def diff = nowPlusDays.millis - now.millis
        def expectedMillis = days * 24 * 60 * 60 * 1000
        assertEquals expectedMillis, diff
    }
--- end

(I realise the above code isn't the optimal for the test but it is representative of what happens in production)

Now - if I set "days" to be 7, for example, it works as expected.  If I set it to be 20 then it fails.  When I debug I can see that the toString method of now returns "2011-10-11T00:00:00.000+01:00" however nowPlusDays returns "2011-10-31T00:00:00.000Z".  The iChronology of both of them is "ISOChronology[Europe/London]".

This code has been working for years(!) although in production I am only ever using this to determine when things should expire so it may well be that I haven't picked it up.  The tests are run on every checking (multiple times a day) and this is the first time it has failed.  

Any ideas - this has come completely out of the blue and I have no idea how to work around it.  I am assuming it is a bug and I couldn't find any FAQ items related to this...

On an aside - what is the idiomatic way to determine the number of whole days between two dates?  I use DateMidnight as I thought that would simplify things ;).

Many thanks,

Col

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

Mark Carroll
Colin Yates wrote:

> On an aside - what is the idiomatic way to determine the number of whole days between two dates?

Days.daysBetween is often handy.

Mark

--
Mark Carroll
Software Engineer
[hidden email]
http://www.vecna.com/

Cambridge Research Laboratory
Vecna Technologies, Inc.
36 Cambridge Park Drive
Cambridge, MA 02140
Phone: (617) 864-0636
Fax: (617) 864-0638

Better Technology, Better World (TM)

The contents of this message may be privileged and confidential.
Therefore, if this message has been received in error, please delete it
without reading it. Your receipt of this message is not intended to
waive any applicable privilege. Please do not disseminate this message
without the permission of the author.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

Mauro Ciancio
In reply to this post by Colin Yates
Hi,
I'm very far from being a Joda Time expert but this kind of "weird" behavior also happened to me a couple of years ago.
That had something to do with Time Zones and the fact that some instants are not available (ie: do not exist) in specifics TimeZones. Could this be your case?

You can always force the TimeZone to UTC when doing calculations so this problem does not happen anymore.
See http://joda-time.sourceforge.net/api-release/org/joda/time/LocalDate.html#toDateMidnight(org.joda.time.DateTimeZone)

Regards.

On Tue, Oct 11, 2011 at 3:56 PM, Colin Yates <[hidden email]> wrote:
Today my tests started to fail even though I haven't changed anything for weeks (first day back after a period of illness).  I have isolated the problem to the fact that when I call DateTime.toDateMidnight() it *sometimes* changes the offset from '+01:00' to 'Z'.

As an experienced programmer, the first thing I would be thinking after reading this is "muppet must be doing something stupid" only I don't think I am :).

The following (groovy) snippet exhibits this behaviour:

--- start
   @Test
   public void silly() {
       def days = 20
       DateMidnight now = new DateTime()
       DateMidnight nowPlusDays = now.toDateTime().plusDays(days).toDateMidnight()

       def diff = nowPlusDays.millis - now.millis
       def expectedMillis = days * 24 * 60 * 60 * 1000
       assertEquals expectedMillis, diff
   }
--- end

(I realise the above code isn't the optimal for the test but it is representative of what happens in production)

Now - if I set "days" to be 7, for example, it works as expected.  If I set it to be 20 then it fails.  When I debug I can see that the toString method of now returns "2011-10-11T00:00:00.000+01:00" however nowPlusDays returns "2011-10-31T00:00:00.000Z".  The iChronology of both of them is "ISOChronology[Europe/London]".

This code has been working for years(!) although in production I am only ever using this to determine when things should expire so it may well be that I haven't picked it up.  The tests are run on every checking (multiple times a day) and this is the first time it has failed.

Any ideas - this has come completely out of the blue and I have no idea how to work around it.  I am assuming it is a bug and I couldn't find any FAQ items related to this...

On an aside - what is the idiomatic way to determine the number of whole days between two dates?  I use DateMidnight as I thought that would simplify things ;).

Many thanks,

Col

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest



--
Mauro Ciancio
http://about.me/maurociancio

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

Colin Yates
I tried that but with no effect :(

Sent from my iPad

On 11 Oct 2011, at 20:09, Mauro Ciancio <[hidden email]> wrote:

Hi,
I'm very far from being a Joda Time expert but this kind of "weird" behavior also happened to me a couple of years ago.
That had something to do with Time Zones and the fact that some instants are not available (ie: do not exist) in specifics TimeZones. Could this be your case?

You can always force the TimeZone to UTC when doing calculations so this problem does not happen anymore.
See http://joda-time.sourceforge.net/api-release/org/joda/time/LocalDate.html#toDateMidnight(org.joda.time.DateTimeZone)

Regards.

On Tue, Oct 11, 2011 at 3:56 PM, Colin Yates <[hidden email]> wrote:
Today my tests started to fail even though I haven't changed anything for weeks (first day back after a period of illness).  I have isolated the problem to the fact that when I call DateTime.toDateMidnight() it *sometimes* changes the offset from '+01:00' to 'Z'.

As an experienced programmer, the first thing I would be thinking after reading this is "muppet must be doing something stupid" only I don't think I am :).

The following (groovy) snippet exhibits this behaviour:

--- start
   @Test
   public void silly() {
       def days = 20
       DateMidnight now = new DateTime()
       DateMidnight nowPlusDays = now.toDateTime().plusDays(days).toDateMidnight()

       def diff = nowPlusDays.millis - now.millis
       def expectedMillis = days * 24 * 60 * 60 * 1000
       assertEquals expectedMillis, diff
   }
--- end

(I realise the above code isn't the optimal for the test but it is representative of what happens in production)

Now - if I set "days" to be 7, for example, it works as expected.  If I set it to be 20 then it fails.  When I debug I can see that the toString method of now returns "2011-10-11T00:00:00.000+01:00" however nowPlusDays returns "2011-10-31T00:00:00.000Z".  The iChronology of both of them is "ISOChronology[Europe/London]".

This code has been working for years(!) although in production I am only ever using this to determine when things should expire so it may well be that I haven't picked it up.  The tests are run on every checking (multiple times a day) and this is the first time it has failed.

Any ideas - this has come completely out of the blue and I have no idea how to work around it.  I am assuming it is a bug and I couldn't find any FAQ items related to this...

On an aside - what is the idiomatic way to determine the number of whole days between two dates?  I use DateMidnight as I thought that would simplify things ;).

Many thanks,

Col

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest



--
Mauro Ciancio
http://about.me/maurociancio
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

Mauro Ciancio
Hi, sorry. So we need to wait for the Joda Time experts.

Regards.

On Tue, Oct 11, 2011 at 4:10 PM, Colin Yates <[hidden email]> wrote:
I tried that but with no effect :(

Sent from my iPad

On 11 Oct 2011, at 20:09, Mauro Ciancio <[hidden email]> wrote:

Hi,
I'm very far from being a Joda Time expert but this kind of "weird" behavior also happened to me a couple of years ago.
That had something to do with Time Zones and the fact that some instants are not available (ie: do not exist) in specifics TimeZones. Could this be your case?

You can always force the TimeZone to UTC when doing calculations so this problem does not happen anymore.
See http://joda-time.sourceforge.net/api-release/org/joda/time/LocalDate.html#toDateMidnight(org.joda.time.DateTimeZone)

Regards.

On Tue, Oct 11, 2011 at 3:56 PM, Colin Yates <[hidden email][hidden email]> wrote:
Today my tests started to fail even though I haven't changed anything for weeks (first day back after a period of illness).  I have isolated the problem to the fact that when I call DateTime.toDateMidnight() it *sometimes* changes the offset from '+01:00' to 'Z'.

As an experienced programmer, the first thing I would be thinking after reading this is "muppet must be doing something stupid" only I don't think I am :).

The following (groovy) snippet exhibits this behaviour:

--- start
   @Test
   public void silly() {
       def days = 20
       DateMidnight now = new DateTime()
       DateMidnight nowPlusDays = now.toDateTime().plusDays(days).toDateMidnight()

       def diff = nowPlusDays.millis - now.millis
       def expectedMillis = days * 24 * 60 * 60 * 1000
       assertEquals expectedMillis, diff
   }
--- end

(I realise the above code isn't the optimal for the test but it is representative of what happens in production)

Now - if I set "days" to be 7, for example, it works as expected.  If I set it to be 20 then it fails.  When I debug I can see that the toString method of now returns "2011-10-11T00:00:00.000+01:00" however nowPlusDays returns "2011-10-31T00:00:00.000Z".  The iChronology of both of them is "ISOChronology[Europe/London]".

This code has been working for years(!) although in production I am only ever using this to determine when things should expire so it may well be that I haven't picked it up.  The tests are run on every checking (multiple times a day) and this is the first time it has failed.

Any ideas - this has come completely out of the blue and I have no idea how to work around it.  I am assuming it is a bug and I couldn't find any FAQ items related to this...

On an aside - what is the idiomatic way to determine the number of whole days between two dates?  I use DateMidnight as I thought that would simplify things ;).

Many thanks,

Col

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email][hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest



--
Mauro Ciancio
http://about.me/maurociancio
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest




--
Mauro Ciancio
http://about.me/maurociancio

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

Colin Yates
Hey, don't apologise - thanks for your (and others) help!

Sent from my iPad

On 11 Oct 2011, at 20:57, Mauro Ciancio <[hidden email]> wrote:

Hi, sorry. So we need to wait for the Joda Time experts.

Regards.

On Tue, Oct 11, 2011 at 4:10 PM, Colin Yates <[hidden email]> wrote:
I tried that but with no effect :(

Sent from my iPad

On 11 Oct 2011, at 20:09, Mauro Ciancio <[hidden email]> wrote:

Hi,
I'm very far from being a Joda Time expert but this kind of "weird" behavior also happened to me a couple of years ago.
That had something to do with Time Zones and the fact that some instants are not available (ie: do not exist) in specifics TimeZones. Could this be your case?

You can always force the TimeZone to UTC when doing calculations so this problem does not happen anymore.
See http://joda-time.sourceforge.net/api-release/org/joda/time/LocalDate.html#toDateMidnight(org.joda.time.DateTimeZone)

Regards.

On Tue, Oct 11, 2011 at 3:56 PM, Colin Yates <[hidden email][hidden email]> wrote:
Today my tests started to fail even though I haven't changed anything for weeks (first day back after a period of illness).  I have isolated the problem to the fact that when I call DateTime.toDateMidnight() it *sometimes* changes the offset from '+01:00' to 'Z'.

As an experienced programmer, the first thing I would be thinking after reading this is "muppet must be doing something stupid" only I don't think I am :).

The following (groovy) snippet exhibits this behaviour:

--- start
   @Test
   public void silly() {
       def days = 20
       DateMidnight now = new DateTime()
       DateMidnight nowPlusDays = now.toDateTime().plusDays(days).toDateMidnight()

       def diff = nowPlusDays.millis - now.millis
       def expectedMillis = days * 24 * 60 * 60 * 1000
       assertEquals expectedMillis, diff
   }
--- end

(I realise the above code isn't the optimal for the test but it is representative of what happens in production)

Now - if I set "days" to be 7, for example, it works as expected.  If I set it to be 20 then it fails.  When I debug I can see that the toString method of now returns "2011-10-11T00:00:00.000+01:00" however nowPlusDays returns "2011-10-31T00:00:00.000Z".  The iChronology of both of them is "ISOChronology[Europe/London]".

This code has been working for years(!) although in production I am only ever using this to determine when things should expire so it may well be that I haven't picked it up.  The tests are run on every checking (multiple times a day) and this is the first time it has failed.

Any ideas - this has come completely out of the blue and I have no idea how to work around it.  I am assuming it is a bug and I couldn't find any FAQ items related to this...

On an aside - what is the idiomatic way to determine the number of whole days between two dates?  I use DateMidnight as I thought that would simplify things ;).

Many thanks,

Col

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email][hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest



--
Mauro Ciancio
http://about.me/maurociancio
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest




--
Mauro Ciancio
http://about.me/maurociancio
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

Bård Dybwad Kristensen
In reply to this post by Mark Carroll
Hi

Without testing anything, my guess would be that it is related to the fact that London goes over to winter time Sunday 30th of October at 02:30 local time. I guess you are aware of this. The time zone goes from offset +1 to UTC. So if you have midnight today it will have an offset of  +01, but midnight the 31th will have an offset of zero, ie UTC. That makes sense, does it not? And everything is as expected?

regards,
Bård

On Tue, Oct 11, 2011 at 21:03, Mark Carroll <[hidden email]> wrote:
Colin Yates wrote:

> On an aside - what is the idiomatic way to determine the number of whole days between two dates?

Days.daysBetween is often handy.

Mark

--
Mark Carroll
Software Engineer
[hidden email]
http://www.vecna.com/

Cambridge Research Laboratory
Vecna Technologies, Inc.
36 Cambridge Park Drive
Cambridge, MA 02140
Phone: <a href="tel:%28617%29%20864-0636" value="+16178640636">(617) 864-0636
Fax: <a href="tel:%28617%29%20864-0638" value="+16178640638">(617) 864-0638

Better Technology, Better World (TM)

The contents of this message may be privileged and confidential.
Therefore, if this message has been received in error, please delete it
without reading it. Your receipt of this message is not intended to
waive any applicable privilege. Please do not disseminate this message
without the permission of the author.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

Colin Yates
The idiomatic way seems to be new Period(start, end, PeriodType.days()).toStandardDays().getDays()

Thanks for everyones help :)

Col

Excerpts from Bård Dybwad Kristensen's message of 2011-10-11 23:16:01 +0100:

> Hi
>
> Without testing anything, my guess would be that it is related to the fact
> that London goes over to winter time Sunday 30th of October at 02:30 local
> time. I guess you are aware of this. The time zone goes from offset +1 to
> UTC. So if you have midnight today it will have an offset of  +01, but
> midnight the 31th will have an offset of zero, ie UTC. That makes sense,
> does it not? And everything is as expected?
>
> regards,
> Bård
>
> On Tue, Oct 11, 2011 at 21:03, Mark Carroll <[hidden email]> wrote:
>
> > Colin Yates wrote:
> >
> > > On an aside - what is the idiomatic way to determine the number of whole
> > days between two dates?
> >
> > Days.daysBetween is often handy.
> >
> > Mark
> >
> > --
> > Mark Carroll
> > Software Engineer
> > [hidden email]
> > http://www.vecna.com/
> >
> > Cambridge Research Laboratory
> > Vecna Technologies, Inc.
> > 36 Cambridge Park Drive
> > Cambridge, MA 02140
> > Phone: (617) 864-0636
> > Fax: (617) 864-0638
> >
> > Better Technology, Better World (TM)
> >
> > The contents of this message may be privileged and confidential.
> > Therefore, if this message has been received in error, please delete it
> > without reading it. Your receipt of this message is not intended to
> > waive any applicable privilege. Please do not disseminate this message
> > without the permission of the author.
> >
> >
> > ------------------------------------------------------------------------------
> > All the data continuously generated in your IT infrastructure contains a
> > definitive record of customers, application performance, security
> > threats, fraudulent activity and more. Splunk takes this data and makes
> > sense of it. Business sense. IT sense. Common sense.
> > http://p.sf.net/sfu/splunk-d2d-oct
> > _______________________________________________
> > Joda-interest mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/joda-interest
> >

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

jodastephen
The recommended solution for days between is
int days = Days.daysBetween(start, end).getDays();
http://joda-time.sourceforge.net/key_period.html

Stephen


On 12 October 2011 10:38, Colin Yates <[hidden email]> wrote:

> The idiomatic way seems to be new Period(start, end, PeriodType.days()).toStandardDays().getDays()
>
> Thanks for everyones help :)
>
> Col
>
> Excerpts from Bård Dybwad Kristensen's message of 2011-10-11 23:16:01 +0100:
>> Hi
>>
>> Without testing anything, my guess would be that it is related to the fact
>> that London goes over to winter time Sunday 30th of October at 02:30 local
>> time. I guess you are aware of this. The time zone goes from offset +1 to
>> UTC. So if you have midnight today it will have an offset of  +01, but
>> midnight the 31th will have an offset of zero, ie UTC. That makes sense,
>> does it not? And everything is as expected?
>>
>> regards,
>> Bård
>>
>> On Tue, Oct 11, 2011 at 21:03, Mark Carroll <[hidden email]> wrote:
>>
>> > Colin Yates wrote:
>> >
>> > > On an aside - what is the idiomatic way to determine the number of whole
>> > days between two dates?
>> >
>> > Days.daysBetween is often handy.
>> >
>> > Mark
>> >
>> > --
>> > Mark Carroll
>> > Software Engineer
>> > [hidden email]
>> > http://www.vecna.com/
>> >
>> > Cambridge Research Laboratory
>> > Vecna Technologies, Inc.
>> > 36 Cambridge Park Drive
>> > Cambridge, MA 02140
>> > Phone: (617) 864-0636
>> > Fax: (617) 864-0638
>> >
>> > Better Technology, Better World (TM)
>> >
>> > The contents of this message may be privileged and confidential.
>> > Therefore, if this message has been received in error, please delete it
>> > without reading it. Your receipt of this message is not intended to
>> > waive any applicable privilege. Please do not disseminate this message
>> > without the permission of the author.
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > All the data continuously generated in your IT infrastructure contains a
>> > definitive record of customers, application performance, security
>> > threats, fraudulent activity and more. Splunk takes this data and makes
>> > sense of it. Business sense. IT sense. Common sense.
>> > http://p.sf.net/sfu/splunk-d2d-oct
>> > _______________________________________________
>> > Joda-interest mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/joda-interest
>> >
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: DateMidnight switches between +01:00 and Z (!!) on joda-time-1.6 Hi all,

jodastephen
In reply to this post by Bård Dybwad Kristensen
Bård's explanation is correct. DST has ended, so the offset changes
from +01:00 to :00:00 (or "Z").

If you don't care about time-zones or offsets you should use
LocalDate, not DateMidnight. Since the library was created I've found
that DateMidnight is a poor chioce for applications to use.

Stephen



On 11 October 2011 23:16, Bård Dybwad Kristensen <[hidden email]> wrote:

> Hi
>
> Without testing anything, my guess would be that it is related to the fact
> that London goes over to winter time Sunday 30th of October at 02:30 local
> time. I guess you are aware of this. The time zone goes from offset +1 to
> UTC. So if you have midnight today it will have an offset of  +01, but
> midnight the 31th will have an offset of zero, ie UTC. That makes sense,
> does it not? And everything is as expected?
>
> regards,
> Bård
>
> On Tue, Oct 11, 2011 at 21:03, Mark Carroll <[hidden email]> wrote:
>>
>> Colin Yates wrote:
>>
>> > On an aside - what is the idiomatic way to determine the number of whole
>> > days between two dates?
>>
>> Days.daysBetween is often handy.
>>
>> Mark
>>
>> --
>> Mark Carroll
>> Software Engineer
>> [hidden email]
>> http://www.vecna.com/
>>
>> Cambridge Research Laboratory
>> Vecna Technologies, Inc.
>> 36 Cambridge Park Drive
>> Cambridge, MA 02140
>> Phone: (617) 864-0636
>> Fax: (617) 864-0638
>>
>> Better Technology, Better World (TM)
>>
>> The contents of this message may be privileged and confidential.
>> Therefore, if this message has been received in error, please delete it
>> without reading it. Your receipt of this message is not intended to
>> waive any applicable privilege. Please do not disseminate this message
>> without the permission of the author.
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure contains a
>> definitive record of customers, application performance, security
>> threats, fraudulent activity and more. Splunk takes this data and makes
>> sense of it. Business sense. IT sense. Common sense.
>> http://p.sf.net/sfu/splunk-d2d-oct
>> _______________________________________________
>> Joda-interest mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Loading...