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 2018/04/04 23:26:49 UTC

Date formatting error?

The formatting for Excel...say no more...but I'm having an issue with
century vs. no century.

If I just use the basic short format in Excel, it includes the century and
appears to be:

m/d/yy

Which, when I run the apply function, I get no century. (I can see why I
wouldn't.) When I take the century out in Excel, the format seems to be:

m/d/yy;@

​Am I missing something or is this a discrepancy?​


-- 

*Blake Watson*

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

Re: Date formatting error?

Posted by Blake Watson <bl...@pnmac.com>.
I'm trying to get my tests set up right, but I hadn't thought of looking
there for clues, so I'll try that, thanks!

As for what I'm doing:

1. style = cell.getCellStyle (all XSSF)
2. datafmt = style.getDataFormatString
3. cf = CellFormat.getInstance(datafmt)
4. result = cf.apply(cell)
5. ====> result.text

The datafmt is coming out with the right stuff, but the apply is always
returning a "1/1/01" type date.


On Thu, Apr 5, 2018 at 11:26 AM, Dominik Stadler <do...@gmx.at>
wrote:

> Hi,
>
> Not sure where you exactly see a bug here. There are quite a number of
> unit-tests which verify various formats/variations, maybe you can put your
> case into a unit-test as well? That would make it easier to comment if you
> should be using some API differently or if there is indeed a bug here.
>
> Thanks... Dominik.
>
> On Thu, Apr 5, 2018 at 8:06 PM, Blake Watson <bl...@pnmac.com>
> wrote:
>
> > This appears to be a bug. I thought maybe it was related to the Windows
> > locale short-date format, but even that seems to return the century.
> >
> > On further testing, EVERY date format seems to return m/d/yy, regardless
> of
> > the format string.
> >
> > On Wed, Apr 4, 2018 at 4:26 PM, Blake Watson <bl...@pnmac.com>
> > wrote:
> >
> > > The formatting for Excel...say no more...but I'm having an issue with
> > > century vs. no century.
> > >
> > > If I just use the basic short format in Excel, it includes the century
> > and
> > > appears to be:
> > >
> > > m/d/yy
> > >
> > > Which, when I run the apply function, I get no century. (I can see why
> I
> > > wouldn't.) When I take the century out in Excel, the format seems to
> be:
> > >
> > > m/d/yy;@
> > >
> > > ​Am I missing something or is this a discrepancy?​
> > >
> > >
> > > --
> > >
> > > *Blake Watson*
> > >
> > > *PNMAC*
> > > Application Development Manager
> > > 5898 Condor Drive
> > > Moorpark, CA 93021
> > > (805) 330.4911 x7742
> > > blake.watson@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
> > 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
www.PennyMacUSA.com <http://www.pennymacusa.com/>

Re: Date formatting error?

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

Not sure where you exactly see a bug here. There are quite a number of
unit-tests which verify various formats/variations, maybe you can put your
case into a unit-test as well? That would make it easier to comment if you
should be using some API differently or if there is indeed a bug here.

Thanks... Dominik.

On Thu, Apr 5, 2018 at 8:06 PM, Blake Watson <bl...@pnmac.com> wrote:

> This appears to be a bug. I thought maybe it was related to the Windows
> locale short-date format, but even that seems to return the century.
>
> On further testing, EVERY date format seems to return m/d/yy, regardless of
> the format string.
>
> On Wed, Apr 4, 2018 at 4:26 PM, Blake Watson <bl...@pnmac.com>
> wrote:
>
> > The formatting for Excel...say no more...but I'm having an issue with
> > century vs. no century.
> >
> > If I just use the basic short format in Excel, it includes the century
> and
> > appears to be:
> >
> > m/d/yy
> >
> > Which, when I run the apply function, I get no century. (I can see why I
> > wouldn't.) When I take the century out in Excel, the format seems to be:
> >
> > m/d/yy;@
> >
> > ​Am I missing something or is this a discrepancy?​
> >
> >
> > --
> >
> > *Blake Watson*
> >
> > *PNMAC*
> > Application Development Manager
> > 5898 Condor Drive
> > Moorpark, CA 93021
> > (805) 330.4911 x7742
> > blake.watson@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
> www.PennyMacUSA.com <http://www.pennymacusa.com/>
>

Re: Date formatting error?

Posted by Blake Watson <bl...@pnmac.com>.
This appears to be a bug. I thought maybe it was related to the Windows
locale short-date format, but even that seems to return the century.

On further testing, EVERY date format seems to return m/d/yy, regardless of
the format string.

On Wed, Apr 4, 2018 at 4:26 PM, Blake Watson <bl...@pnmac.com> wrote:

> The formatting for Excel...say no more...but I'm having an issue with
> century vs. no century.
>
> If I just use the basic short format in Excel, it includes the century and
> appears to be:
>
> m/d/yy
>
> Which, when I run the apply function, I get no century. (I can see why I
> wouldn't.) When I take the century out in Excel, the format seems to be:
>
> m/d/yy;@
>
> ​Am I missing something or is this a discrepancy?​
>
>
> --
>
> *Blake Watson*
>
> *PNMAC*
> Application Development Manager
> 5898 Condor Drive
> Moorpark, CA 93021
> (805) 330.4911 x7742
> blake.watson@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
www.PennyMacUSA.com <http://www.pennymacusa.com/>