• Post Reply Bookmark Topic Watch Topic
  • New Topic

Strange problem with respect to java.util.Date  RSS feed

 
Karthik Krishnamurthy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having a problem with Date Objects.
We have written an enterprise application for a web-based product. We get the person's birth date entered as (eg 07-17-1923). The object is stored in a date object and when it is written out (using sdf.format(date), where sdf is a SimpleDateFormat("yyyyMMdd") and date is in the above MM-dd-yyyy format,
the resultant value is 19230716
It seems to be a day lesser. and Its happening across the board. When the current date (03-20-2008) is passed it gets written out as 03-19-2008.
THe flow is :
Web-page-> Date Entry -> Submission -> Date Parsing -> Pass the date to EAR-> Write out the date.

Any help will be greatly appreciated.

Thanks
Karthik
 
Paul Clapham
Sheriff
Posts: 22838
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably you are converting the string to a date using one time zone, and later converting the date back to a string using a different time zone which is farther west.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!