You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by shibsankar <sr...@gmail.com> on 2019/06/29 02:33:01 UTC

Excel Formula for POI

Hi,

I am doing excel parsing with POI.

I have an excel cell where Formula is written.

Formula is :  =MROUND((IF(NZ38="","",NZ38+OB38)),TIME(0,10,0)).  This shows
data in cell like this : Mon 30/12 23:30

But I want the data in this format : 12/30/19 23:10 . I get this  when I do
Format cell > right click > Format Cell > Date > Type [ MM/DD/YY HH:MM ](24
hrs)

How do I get the same by POI programmatically ?

Thanks
Shib

Re: Excel Formula for POI

Posted by Dominik Stadler <do...@gmx.at>.
Hi,

Did you try something like

cellStyle.setDataFormat(
        createHelper.createDataFormat().getFormat("m/d/yy h:mm"));

The complete example is available at
http://poi.apache.org/components/spreadsheet/quick-guide.html#CreateDateCells

Regards.. Dominik.



On Sat, Jun 29, 2019 at 4:33 AM shibsankar <sr...@gmail.com> wrote:

> Hi,
>
> I am doing excel parsing with POI.
>
> I have an excel cell where Formula is written.
>
> Formula is :  =MROUND((IF(NZ38="","",NZ38+OB38)),TIME(0,10,0)).  This shows
> data in cell like this : Mon 30/12 23:30
>
> But I want the data in this format : 12/30/19 23:10 . I get this  when I do
> Format cell > right click > Format Cell > Date > Type [ MM/DD/YY HH:MM ](24
> hrs)
>
> How do I get the same by POI programmatically ?
>
> Thanks
> Shib
>