Just found the DateMidnight class, which has solved my problem. FWIW I just create one of those using the year, month and day of each of my two dates, and I now get the right answers.
Cool API :) Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gundersen, Richard Sent: Wednesday, January 16, 2008 12:08 PM To: Discussion of the Joda project Subject: Re: [Joda-interest] daysBetween and Daylight Saving question Actually, I think I can simplify my question somewhat. I just need a method that only takes the day, month and year into account. i.e. as if you have a paper calendar in front of you, and you are just counting the squares between two dates on the calendar. Please help, thanks :) Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gundersen, Richard Sent: Wednesday, January 16, 2008 11:48 AM To: joda-interest@lists.sourceforge.net Subject: [Joda-interest] daysBetween and Daylight Saving question Hi I can't browse the archives for some reason so sorry if this has already been asked before. I need to count the days between two dates. I'm using the Days class like this days = Days.daysBetween(before, after); Most of the time this works, but sometimes one of the dates I am comparing is in BST, while the other is GMT. So there is an hours difference, and this can give me the wrong result (the number of whole days between e.g. 14:00h Jan 1st (BST) and 14:00h Jan 2nd (GMT) is 11 hours, not 12 so the result is 0, instead of 1. I know Joda is technically correct in the way it handles this, but I want the daysBetween to just count the day, without considering daylight saving. Think of a person entering some data at Midnight on Wednesday BST. I want to convert it back to GMT but without it changing to 11pm Tuesday (so, from the System point of view, yes it's Tuesday, but from the person's point of view they entered it on Wednesday. Something like this would be what I'm after: days = Days.daysBetweenIgnoringDaylightSaving(before, after); Can I achive this kind of thing with Joda? Regards Richard Gundersen As a responsible corporate citizen, London Scottish Bank plc asks you to consider the environment before printing this email. *** Disclaimer *** This electronic communication is confidential and for the exclusive use of the addressee. It may contain private and confidential information. The information, attachments and opinions contained in this E-mail are those of its author only and do not necessarily represent those of London Scottish Bank PLC or any other members of the London Scottish Group. If you are not the intended addressee, you are prohibited from any disclosure, distribution or further copying or use of this communication or the information in it or taking any action in reliance on it. If you have received this communication in error please notify the Information Security Manager at [EMAIL PROTECTED] as soon as possible and delete the message from all places in your computer where it is stored. We utilise virus scanning software but we cannot guarantee the security of electronic communications and you are advised to check any attachments for viruses. We do not accept liability for any loss resulting from any corruption or alteration of data or importation of any virus as a result of receiving this electronic communication. Replies to this E-mail may be monitored for operational or business reasons. London Scottish Bank PLC is regulated by the Financial Services Authority. London Scottish Bank plc, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 973008 England. Subsidiary Companies:- London Scottish Finance Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 233259 England. London Scottish Broking Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 230110 England. London Scottish Invoice Finance Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 2643766 England. Robinson Way & Company Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 885896 England. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. ------------------------------------------------------------------------ - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ As a responsible corporate citizen, London Scottish Bank plc asks you to consider the environment before printing this email. *** Disclaimer *** This electronic communication is confidential and for the exclusive use of the addressee. It may contain private and confidential information. The information, attachments and opinions contained in this E-mail are those of its author only and do not necessarily represent those of London Scottish Bank PLC or any other members of the London Scottish Group. If you are not the intended addressee, you are prohibited from any disclosure, distribution or further copying or use of this communication or the information in it or taking any action in reliance on it. If you have received this communication in error please notify the Information Security Manager at [EMAIL PROTECTED] as soon as possible and delete the message from all places in your computer where it is stored. We utilise virus scanning software but we cannot guarantee the security of electronic communications and you are advised to check any attachments for viruses. We do not accept liability for any loss resulting from any corruption or alteration of data or importation of any virus as a result of receiving this electronic communication. Replies to this E-mail may be monitored for operational or business reasons. London Scottish Bank PLC is regulated by the Financial Services Authority. London Scottish Bank plc, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 973008 England. Subsidiary Companies:- London Scottish Finance Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 233259 England. London Scottish Broking Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 230110 England. London Scottish Invoice Finance Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 2643766 England. Robinson Way & Company Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 885896 England. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. ------------------------------------------------------------------------ - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ As a responsible corporate citizen, London Scottish Bank plc asks you to consider the environment before printing this email. *** Disclaimer *** This electronic communication is confidential and for the exclusive use of the addressee. It may contain private and confidential information. The information, attachments and opinions contained in this E-mail are those of its author only and do not necessarily represent those of London Scottish Bank PLC or any other members of the London Scottish Group. If you are not the intended addressee, you are prohibited from any disclosure, distribution or further copying or use of this communication or the information in it or taking any action in reliance on it. If you have received this communication in error please notify the Information Security Manager at [EMAIL PROTECTED] as soon as possible and delete the message from all places in your computer where it is stored. We utilise virus scanning software but we cannot guarantee the security of electronic communications and you are advised to check any attachments for viruses. We do not accept liability for any loss resulting from any corruption or alteration of data or importation of any virus as a result of receiving this electronic communication. Replies to this E-mail may be monitored for operational or business reasons. London Scottish Bank PLC is regulated by the Financial Services Authority. London Scottish Bank plc, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 973008 England. Subsidiary Companies:- London Scottish Finance Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 233259 England. London Scottish Broking Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 230110 England. London Scottish Invoice Finance Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 2643766 England. Robinson Way & Company Limited, Registered Office: London Scottish House, Mount Street, Manchester M2 3LS Registered Number 885896 England. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest