Android Get Current timestamp?

前端 未结 12 863
灰色年华
灰色年华 2020-11-27 09:53

I want to get the current timestamp like that : 1320917972

int time = (int) (System.currentTimeMillis());
Timestamp tsTemp = new Timestamp(t         


        
12条回答
  •  星月不相逢
    2020-11-27 10:30

    You can use the SimpleDateFormat class:

    SimpleDateFormat s = new SimpleDateFormat("ddMMyyyyhhmmss");
    String format = s.format(new Date());
    

提交回复
热议问题