I have a requirement to log the sensor data in Android. In order to store the values in a Database, I need the timestamp as primary key in the format - hh:mm:ss:SS, where SS
use SimpleDateFormat, see tutorial here. But it's not recommended this approach, if you save it as a long, you can compare it, order, etc...