In Android, the date of every event (such as birthdays and anniversaries) is saved in String format, e.g. "2011-12-24".
This is at least the case for my phone. Some other phones may perhaps store these dates in other formats if they have a calendar different from the Gregorian one.
Even for phones with the Gregorian calendar set, there are date Strings with hours and minutes and without. I get such a date String when I query the contacts table for an event:
cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Event.START_DATE))
This results in (for example):
"2011-12-14" or "2011-12-24T00:00:00Z"
You can see that there are lots of different possible formats. In order to calculate with dates, I need to convert them from String to Date objects, needn't I?
How can I do this?
PS: I know there is a parse function for java date objects:
DateFormat myDateFormat = new SimpleDateFormat("dd/MM/yy");
Date tempDate = myDateFormat.parse("24/12/2011");
But in Android, I don't know which format I'll be confronted with, do I?