-1

I am getting response from server string for Time . How to convert that string into Date . My Response String is like this January 2, 2010 . Now i want to convert it into 02/01/2010. After converting try to make a ArrayList which is sorted date wise.

aslamhossin
  • 1,217
  • 12
  • 22
  • Have you tried using the Android Calendar class? http://developer.android.com/reference/java/util/Calendar.html – The 42nd Doctor Mar 27 '15 at 14:16
  • 1
    maybe this [stack over flow post](http://stackoverflow.com/questions/5369682/get-current-time-and-date-on-android) is what you need – Sony Mar 27 '15 at 14:18
  • I've used Date() . How can i use calender Class ? – aslamhossin Mar 27 '15 at 14:21
  • You would need to import it using `import java.util.Calendar;`. You can then set variables as Calendar types using, for example, `Calendar dateSet= Calendar.getInstance();` The Android documentation will tell you a lot more about what you can do with Calendar. – The 42nd Doctor Mar 27 '15 at 15:29

1 Answers1

1

For the System time use :

long timeInMs = System.currentTimeMillis();

Then you can bring it in the format you want

TheTanic
  • 1,510
  • 15
  • 29