2015年10月14日 星期三

[Android] set current time


//SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd,HH:mm:ss");
Date curDate = new Date(System.currentTimeMillis()) ; // 獲取當前時間
String now_time = formatter.format(curDate);

reference: http://bibby1101.pixnet.net/blog/post/44759449-%E3%80%8Aandroid%E3%80%8B%E6%8A%93%E5%8F%96%E6%89%8B%E6%A9%9F%E4%B8%8A%E6%99%82%E9%96%93%E8%B3%87%E8%A8%8A


沒有留言:

張貼留言