Date (time) to 24-hour format in Java
Use SimpleDateFormat to format a date (time) into a 24-hour format in Java.
If you use “hhmm”, 1310 becomes 0110.
If you use “HHmm”, 1310 becomes 1310 24-hour notation.
Date date = new Date(); DateFormat sdf = new SimpleDateFormat("yyMMddHHmm"); String dt = sdf.format(date);
コメント