poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saravanan P <saravanan....@gmail.com>
Subject Re: how to print the exact date cell value in the excel sheet date format like mm/dd/yyyy using apache poi 3.5
Date Thu, 18 Nov 2010 08:30:28 GMT
*Thanks Mark,

It is working good.But only one correction in your
statements.formatCellValue(Cell) method belongs to DataFormatter class and
not DataFormat class...

Thank you very much for your reply.

**Thanks & Regards,

Never Design your life like GARDEN, any one can walk...!
So, Design your life like SKY where every one has aspire to reach...!

On Thu, Nov 18, 2010 at 1:32 PM, Mark Beardsley <markbrdsly@tiscali.co.uk>wrote:

> If the format applied to the date value within the cell already ensures
> that
> it is displayed as mm/dd/yyyy then all you need to do is use the
> formatCellValue(Cell) method of the DataFormat class. This will return a
> String that encapsulates the date formatted as it would have been within
> the
> cell.
> On the other hand, if you are working with dates that are formatted
> differenetly and which you always want to convert into that format, use the
> date support - Date\Calendar\GregorianCalendar - that is built into the
> core
> Java API. Here, you would recover a Date value from the Excel cell
> (getDateCellValue() if the cell is a numeric type and if the
> isCellDateFormattedMethod(Cell) of the DateUtil class returns true) and
> then
> use the Calendar classes methods to recover the day, month and year values
> from it. Next, simply create a String using these values and the
> appropriate
> separator.
> Yours
> Mark B
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/how-to-print-the-exact-date-cell-value-in-the-excel-sheet-date-format-like-mm-dd-yyyy-using-apache-p5-tp3270275p3270378.html
> Sent from the POI - User mailing list archive at Nabble.com.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message