It's a simple string at that point, use SimpleDateFormat or Jodatime to
convert it to whatever you like.

Although not best practice I usually build a static block of various
SimpleDateFromat checker that I use with a loop and an empty catch block to
find the right format match.  That'll allow you to do both dates.  Once you
find it though lock it with a semaphore or something so you don't have to
check every time.

Aram

On Fri, Apr 10, 2015 at 8:41 PM, vijayinani <[email protected]> wrote:

> I used DataFormatter to convert it to a String. But it returns MM/DD/YY and
> not MM/DD/YYYY
> I need in MM/DD/YYYY. Did not find the correct method of this in
> DataFormatter.
>
> Thanks and Regards,
> Vijay Inani
> +919765000940
>
> On Fri, Apr 10, 2015 at 2:42 PM, Nick Burch-2 [via Apache POI] <
> [email protected]> wrote:
>
> > On Thu, 9 Apr 2015, vijayinani wrote:
> > > they are same. i.e. in excel it shows as MM/DD/YYYY. But thru code its
> > > reading incorrectly in US.
> > >
> > > My code is simple:
> > >
> > >    if (DateUtil.isCellDateFormatted(cell))
> > >        data.append(cell);
> >
> > Use DataFormatter to convert it to a string, that will preserve the
> > formatting rules. Calling toString() on a cell will not
> >
> > Nick
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > <http:///user/SendEmail.jtp?type=node&node=5718477&i=0>
> > For additional commands, e-mail: [hidden email]
> > <http:///user/SendEmail.jtp?type=node&node=5718477&i=1>
> >
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://apache-poi.1045710.n5.nabble.com/Reading-date-from-excel-file-for-different-locations-tp5718475p5718477.html
> >  To unsubscribe from Reading date from excel file for different
> locations, click
> > here
> > <
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5718475&code=dmlqYXlpbmFuaUBnbWFpbC5jb218NTcxODQ3NXwxNzk3MDE3NzMx
> >
> > .
> > NAML
> > <
> http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/Reading-date-from-excel-file-for-different-locations-tp5718475p5718479.html
> Sent from the POI - User mailing list archive at Nabble.com.
>

Reply via email to