I have a PDF that users must complete. The PDF has date and time fields on it. The PDF instructs the users to input the date and time in Eastern format (Not EST or EDT). When the user completes the PDF they then generate XML from the PDF and and upload the XML to a Java application. The issue here is that the users may enter the time in EDT or EST depending on the time of the year (and maybe even their location?). How can I use Java to then determine if the date/time from the PDF is EDT or EST and then get it into the database as GMT.
+3
A:
Try creating a Date using the information entered into the PDF. Then try using SimpleTimeZone.inDaylightTime(Date) to determine whether you need to adjust for Daylight Savings.
Dave Paroulek
2009-11-12 14:48:39
Unless the time zone is explicit in the date string though, the TimeZone will default to whatever TimeZone is the default for your JVM. The call to inDaylightTime will then just reflect if the time would be in DaylightTime in that for that Date/Timezone combo.
Jason Gritman
2009-11-12 15:11:57