//中文 上午/下午
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd a hh:mm");
System.out.println(sdf.format(new Date()));
//am/pm
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd a hh:mm",Locale.ENGLISH);
System.out.println(sdf2.format(new Date()));
Java中如何将时间设置为12小时制并区分上下午
最新推荐文章于 2024-06-22 16:37:05 发布