I'm trying to create a string with the current date, with this code:
Calendar currentDate=Calendar.getInstance();
string date=""+currentDate.get (java.util.Calendar.MONTH)+"-"+currentDate.get(java.util.Calendar.DAY_OF_MONTH)+"-"+currentDate.get(java.util.Calendar.YEAR);
It gives me the correct year and day, but the month is 1 month behind for some reason. I looked at the clock/date on the emulator and it says may 11, 2010, but the string from my code gives me 4-11-2010. What could be the problem? It may not be an emulator problem because it gives me the same wrong date on an actual device also.