Thursday, March 11, 2010

ADD_MONTH vs add(Calendar.MONTH)

Tagged with: ,
Monday, December 8, 2008, 5:14
This news item was posted in HowTo & Tutorial category and has 0 Comments so far.
The FSF Trophy

I found it very interesting that these two methods are not working same :(

SELECT add_months(TO_DATE(‘28-FEB-2007′), 1) FROM dual = 31-MAR-2007

while

java.util.Calendar c=..//28-FEB-2007
c.add(Calendar.MONTH,1); // gives 28-MAR-2007

which one is true ?
for the situation I am dealing java calculation is correct !

java vs Oracle and again winner is java !!!!

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • Wists
  • LinkedIn
  • Slashdot
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • email
  • Twitter

Related posts:

  1. java.util.Calendar.getInstance() // danger
  2. DistributableEventPublisher for Spring via JGroups

You can leave a response, or trackback from your own site.

Leave a Reply