I have a little java code that finds the date of a person. It looks like this:
Calendar now = Calendar.getInstance();
Calendar dob = Calendar.getInstance();
dob.setTime(birthDay); /*assume this is not null */
int age = now.get(Calendar.YEAR) - dob.get(Calendar.YEAR);
if (now.get(Calendar.DAY_OF_YEAR) < dob.get(Calendar.DAY_OF_YEAR))
{
age--;
}
Now, I want to say if the person is less than 1 year old, find how many months this person is. If the person is less than 1 month old, find how many weeks this person is. and if this person is less than 1 week old, find out how many days this person is.
psuedo code:
if (age < 1)
{
///?
}
Something like: