Rjaibi Mejdi Rjaibi Mejdi -5 years ago 407
Android Question

Android Get Current timestamp?

I want to get the current timestamp like that : 1320917972

int time = (int) (System.currentTimeMillis());
Timestamp tsTemp = new Timestamp(time);
String ts = tsTemp.toString();

Answer Source

The solution is :

Long tsLong = System.currentTimeMillis()/1000;
String ts = tsLong.toString();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download