hi, this is praveen, now i have one problem before me. "I need to display 3 days less than current date". this we can do manually by getting current date & subtracting that from 3. this is fine if date is in a month or year but when month or year is changed then we need to write lot of code. so pls help me if any one know's simple solution for this. thank u.
Joined: Apr 21, 2005
The Calendar class can do this, and if you use disable the lenient parsing, it will handle the situations you describe too I believe:
Note that according to the API docs the Calendar version of roll is broken, but the overridden version in GregorianCalendar does the right thing. Thats why I didn't declare cal to be a Calendar in the code above.
Joined: Feb 08, 2004
use og setLenient() wont help:
Wed Jun 29 14:23:08 BST 2005
Joined: Mar 15, 2004
This isn't necessarily the most API-correct way to do it, but:
If you want to run this code, you'll have to implemnt formatAsIso8601 yourself though ;-)