This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Hashtable of Dates  RSS feed

 
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...
:-(
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!