Results 1 to 2 of 2
Thread: date is not working properly
- 10-12-2010, 08:58 AM #1
Member
- Join Date
- May 2010
- Posts
- 2
- Rep Power
- 0
date is not working properly
Following is the code for adding date
public boolean addDate(int iDate)
{
Calendar cal = Calendar.getInstance();
cal.set(2009,02,01);
cal.add(Calendar.DATE, iDate); // Add days in Dates in Calendar
System.out.println("Date :"+cal.get(Calendar.DATE));
System.out.println("Month :"+cal.get(Calendar.MONTH));
System.out.println("Year :"+cal.get(Calendar.YEAR));
return true;
}
calling the function.
addDate(30);
But the output is giving wrongly, previously for couple of months it was working fine, but now I don't understand why the date function is throwing wrong error
Date :31
Month :2
Year :2009
I don't understand what to do!
- 10-12-2010, 09:04 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Similar Threads
-
Serializing an object not working properly - funky chars.
By getstarted in forum XMLReplies: 4Last Post: 01-10-2009, 12:17 AM -
event handler not working properly
By H3rtaherta in forum Java 2DReplies: 3Last Post: 11-24-2008, 02:39 AM -
Menu item not working properly for mouse events
By Preethi in forum New To JavaReplies: 1Last Post: 09-23-2008, 08:56 AM -
My code is not working properly ..modify it
By Shyam Singh in forum New To JavaReplies: 14Last Post: 07-16-2008, 05:48 PM -
Log4j not working properly....
By prakash_dev in forum Advanced JavaReplies: 0Last Post: 03-17-2008, 12:13 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks