I think you can use this
long time= System.currentTimeMillis();
this returns the current time in milliseconds. it will certainly work
long time= System.currentTimeMillis(); android.util.Log.i("Time Class ", " Time value in millisecinds "+time);
Here is my logcat using the function above
05-13 14:38:03.149: INFO/Time Class(301): Time value in millisecinds 1368436083157
If you have doubts about milliseconds. Check here.
EDIT : the time zone I used to demonstrate the IST code, so if you milliseconds mentioned in the code that matches the time in the log from a different time zone, specify the IST zone.
EDIT . This is a simple approach. But if you need a time zone or any other details, I think this will not be enough. Also look at this approach using android api support
edwin May 13 '13 at 8:51 am 2013-05-13 08:51
source share