Android在代碼中獲取當前系統的時間並格式化

private String getTime() {
    long time = System.currentTimeMillis();//long now = android.os.SystemClock.uptimeMillis();
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:SS");
    Date d1 = new Date(time);
    String t1 = format.format(d1);
    return t1;

}

發佈了74 篇原創文章 · 獲贊 4 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章