Bug 48924 - [Patch] Added a getDate method to DateAndTime that returns Calendar
Summary: [Patch] Added a getDate method to DateAndTime that returns Calendar
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.7-dev
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-16 22:05 UTC by Ryan Lauck
Modified: 2010-05-26 10:40 UTC (History)
0 users



Attachments
svn diff (830 bytes, patch)
2010-03-16 22:14 UTC, Ryan Lauck
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Lauck 2010-03-16 22:05:48 UTC
Currently there is no easy way to get any useful information out of org.apache.poi.hwpf.usermodel.DateAndTime, so I added a added a getDate() method that returns the date and time as a java.util.Calendar.  I am already using this in production code and thought it would be useful to others.

Note: it currently uses Calendar.getInstance() to get the default time-zone and localization - I don't know if the word binary format stores any localization data but if it does this code may need a further enhancement to initialize the Calendar with said data.
Comment 1 Ryan Lauck 2010-03-16 22:14:35 UTC
Created attachment 25137 [details]
svn diff
Comment 2 Nick Burch 2010-05-26 10:40:51 UTC
I've no idea either about timezones

The way to test would be to work with someone elsewhere in the world, and both of you create a simple file around the same moment. Compare those and see!

Patch applied with slight tweaks in r948455.