You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Blake Watson <bl...@pnmac.com> on 2015/02/24 01:11:49 UTC

DateDif

So, I hit my first unimplemented function: DateDif

I'm curious as to why it's not implemented. Just a bunch of ugly code
nobody felt was worth tackling? Or is there something more complex in its
features?

-- 

*Blake Watson*

*PNMAC*
Application Development Manager
5898 Condor Drive
Moorpark, CA 93021
(805) 330.4911 x7742
blake.watson@pnmac.com <me...@pnmac.com>
www.PennyMacUSA.com <http://www.pennymacusa.com/>

Re: DateDif

Posted by Andreas Reichel <an...@manticore-projects.com>.
Dear All,

as I was just working with time gaps, perhaps the following template
might be helpful:

private static int getTimeGap(Date d1, Date d2) {
    int tg = 0;
    int increment = d1.before(d2)
            ? 1
            : -1;
    Calendar cal1 = GregorianCalendar.getInstance();
    cal1.setTime(d1);
    cal1.set(Calendar.HOUR_OF_DAY, 12);
    cal1.set(Calendar.MINUTE, 0);
    cal1.set(Calendar.SECOND, 0);
    cal1.set(Calendar.MILLISECOND, 0);

    Calendar cal2 = GregorianCalendar.getInstance();
    cal2.setTime(d2);
    cal2.set(Calendar.HOUR_OF_DAY, 12);
    cal2.set(Calendar.MINUTE, 0);
    cal2.set(Calendar.SECOND, 0);
    cal2.set(Calendar.MILLISECOND, 0);

    while (cal1.compareTo(cal2) != 0) {
      cal1.add(Calendar.DATE, increment);
      tg += increment;
    }
    return tg;
  }

Best regards
Andreas

On Tue, 2015-02-24 at 09:38 +0000, Nick Burch wrote:
> On Mon, 23 Feb 2015, Blake Watson wrote:
> > So, I hit my first unimplemented function: DateDif
> >
> > I'm curious as to why it's not implemented.
> 
> Because no-one has got round to volunteering a contribution to add it!
> 
> (All the functions used in my $DAYJOB spreadsheets which need POI 
> evaluation are implemented, as I suspect they are for the other 
> contributors to the project so far. We're all volunteers here, so we all 
> work on the things that matter to us)
> 
> 
> If this function matters to you, we'd love a patch! A rough guide to 
> contributing is available at http://poi.apache.org/guidelines.html - a 
> patch plus unit test would be wonderful. If you're new to Excel formula 
> evaluation in POI, then this talk from Yegor from a few years ago is 
> probably the best into we have:
> http://people.apache.org/~yegor/apachecon_us2010/Evaluation_Of_Excel_Formulas_In_POI.pptx
> 
> Please do implement this missing function, and any others too that 
> interest you!
> 
> Thanks
> Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 


Re: DateDif

Posted by Nick Burch <ap...@gagravarr.org>.
On Mon, 23 Feb 2015, Blake Watson wrote:
> So, I hit my first unimplemented function: DateDif
>
> I'm curious as to why it's not implemented.

Because no-one has got round to volunteering a contribution to add it!

(All the functions used in my $DAYJOB spreadsheets which need POI 
evaluation are implemented, as I suspect they are for the other 
contributors to the project so far. We're all volunteers here, so we all 
work on the things that matter to us)


If this function matters to you, we'd love a patch! A rough guide to 
contributing is available at http://poi.apache.org/guidelines.html - a 
patch plus unit test would be wonderful. If you're new to Excel formula 
evaluation in POI, then this talk from Yegor from a few years ago is 
probably the best into we have:
http://people.apache.org/~yegor/apachecon_us2010/Evaluation_Of_Excel_Formulas_In_POI.pptx

Please do implement this missing function, and any others too that 
interest you!

Thanks
Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: DateDif

Posted by Blake Watson <bl...@pnmac.com>.
Heh. There's (almost) always work to do on Open Source projects.

I discovered that DateDif is included in Excel for =Lotus= compatibility
and you can just subtract, so I can see now why no one bothered.

On Mon, Feb 23, 2015 at 11:59 PM, Ники Ч. <ni...@gmail.com> wrote:

> What about the digital signing with poi ? There is a bug :)
>
> On Tue, Feb 24, 2015 at 2:11 AM, Blake Watson <bl...@pnmac.com>
> wrote:
>
> > So, I hit my first unimplemented function: DateDif
> >
> > I'm curious as to why it's not implemented. Just a bunch of ugly code
> > nobody felt was worth tackling? Or is there something more complex in its
> > features?
> >
> > --
> >
> > *Blake Watson*
> >
> > *PNMAC*
> > Application Development Manager
> > 5898 Condor Drive
> > Moorpark, CA 93021
> > (805) 330.4911 x7742
> > blake.watson@pnmac.com <me...@pnmac.com>
> > www.PennyMacUSA.com <http://www.pennymacusa.com/>
> >
>



-- 

*Blake Watson*

*PNMAC*
Application Development Manager
5898 Condor Drive
Moorpark, CA 93021
(805) 330.4911 x7742
blake.watson@pnmac.com <me...@pnmac.com>
www.PennyMacUSA.com <http://www.pennymacusa.com/>

Re: DateDif

Posted by "Ники Ч." <ni...@gmail.com>.
What about the digital signing with poi ? There is a bug :)

On Tue, Feb 24, 2015 at 2:11 AM, Blake Watson <bl...@pnmac.com>
wrote:

> So, I hit my first unimplemented function: DateDif
>
> I'm curious as to why it's not implemented. Just a bunch of ugly code
> nobody felt was worth tackling? Or is there something more complex in its
> features?
>
> --
>
> *Blake Watson*
>
> *PNMAC*
> Application Development Manager
> 5898 Condor Drive
> Moorpark, CA 93021
> (805) 330.4911 x7742
> blake.watson@pnmac.com <me...@pnmac.com>
> www.PennyMacUSA.com <http://www.pennymacusa.com/>
>