JAVA中日期 yyyy-MM-dd HH:mm:ss和yyyy-MM-dd hh:mm:ss的区别 :
HH:24小时制
hh:12小时制
package time; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; /** * Created by sheting on 10/20/2017 */ public class Test { public static void main(String[] args) { // hh 是12小时制 DateFormat dateTimeformat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String strBeginDate = dateTimeformat.format(new Date()); System.out.println(strBeginDate); //2017-10-20 11:59:23 // HH 是24小时制 DateFormat dateTimeformat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String strBeginDate2 = dateTimeformat2.format(new Date()); System.out.println(strBeginDate2); //2017-10-20 11:59:23 } }
来源:https://www.cnblogs.com/zheting/p/7702575.html