I want to get the current date day/month/year min:sec in Android so I have used the follow code
String data="";
Calendar c = Calendar.getInstance();
data=c.getTime().toGMTString();
But Eclipse notify me that the method .toGMTString(); is deprecated.
How could I get the current date as formatted String avoiding the use of this deprecated method?
From the Android documentation:
Since the GMT string is represented as
22 Jun 1999 13:02:00 GMT, we can useSimpleDateFormat(subclass of the abstractDateFormat) like so:Might want to double-check that format, but this’ll get you started.Have a look at this IDEOne code.