my dog learned polymorphism
The moose likes Java in General and the fly likes add(Calendar.DATE) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic


vidhya subramaniam
Ranch Hand

Joined: Jul 14, 2001
Posts: 91
import java.util.Calendar;
import java.util.Properties;
public class datecalc {
public static void main(String args[]){
Calendar rightNow = Calendar.getInstance();
int julianDay = rightNow.get(Calendar.DAY_OF_YEAR);
int day = rightNow.get(Calendar.DATE);

// Create a copy of the rightNow Calendar object
Calendar baseCal = (Calendar)rightNow.clone();
// Subtract 5 days from the date
int i =rightNow.add(Calendar.DATE, -5);

When I do this i get an error on i as incompatible datatypes.
which datatype does add(Calendar.DATE) return?
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

try read the API

Regards, Rene Larsen
Dropbox Invite
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Please follow up your discussion in the original thread rather than starting a new thread for each related question. Thanks.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: add(Calendar.DATE)
It's not a secret anymore!