「Java勉強」現在の日付と時刻を取得する方法

サンプルコード
private void initTime() {

Calendar c = Calendar.getInstance(TimeZone.getTimeZone(“GMT+08:00"));

mYear = c.get(Calendar.YEAR);

mMonth = c.get(Calendar.MONTH) + 1;

mDay = c.get(Calendar.DAY_OF_MONTH);

mHour = c.get(Calendar.HOUR_OF_DAY);

mMinute = c.get(Calendar.MINUTE);

}

Java

Posted by arkgame