• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hashtable of Dates  RSS feed

 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I'm familiarizing mself with Dates and GregorianCalender and at the same time I'm trying to put them into a Hashtable, such that the previous date becomes the last coupon date i.e. prvCouponDate = lstCouponDate and the previous coupon date is recalculated by using the formula prvCouponDate.add(GregorianCalendar.MONTH,(-12/2)
But Java Console shows that my code didn't change the value of prvCouponDate at all. Here is the console output

system datetime stamp: Mar 16, 2004 10:54:17 PM
now: 01 Nov 1992
last coupon date: 15 Jan 1998
previous coupon date: 15 Jul 1997
*** last coupon date: 15 Jul 1997
*** previous coupon date: 15 Jul 1997
0: Thu Jan 15 00:00:00 CST 1998

And here is the offensive code snippet...

Why does this line of code prvCouponDate.add(GregorianCalendar.MONTH,-6) work once only? I would really like to know why Java behaves like this.
TIA :-)
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am so sorry, please close this thread.
I made a spelling mistake.
Works after I corrected my spelling...
:-(
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!