SimpleDateFormat显示格式如2017-05-20 15:00:10,怎么显示为24小时的格式,而不是2017-05-20 3:00:10
亲测:
package test2; import java.text.SimpleDateFormat; import java.util.Date; public class SimpleDateFormatTest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String nowDate = sdf.format(new Date()); System.out.println(nowDate); } } |