package; import java.text.SimpleDateFormat; import
java.util.Calendar;import java.util.Date; import java.util.GregorianCalendar;
public class TestOutDate { public static void main(String[] args) { //method 1
Calendar nowtime =new GregorianCalendar(); String strDateTime
="["+String.format("%04d", nowtime.get(Calendar.YEAR))+"/"+ String.format(
"%02d", nowtime.get(Calendar.MONTH))+"/" + String.format("%02d",
nowtime.get(Calendar.DATE))+" " + String.format("%02d",
nowtime.get(Calendar.HOUR))+":" + String.format("%02d",
nowtime.get(Calendar.MINUTE))+":" + String.format("%02d",
nowtime.get(Calendar.SECOND))+"." + String.format("%03d",
nowtime.get(Calendar.MILLISECOND))+"]"; System.out.println(strDateTime); //
method 2 String msg=""; Date date = new Date(); SimpleDateFormat sdf = new
SimpleDateFormat("YYYY/MM/dd HH:mm:ss.SSS"); msg+="["+sdf.format(date)+"]";
System.out.println(msg); } }
  Operation results :

[2018/04/25 02:51:33.379]

[2018/05/25 14:51:33.393]

©2019-2020 Toolsou All rights reserved,
C Review of basic language knowledge Go Language learning notes (GUI programming )Java Misunderstanding —— Method overloading is a manifestation of polymorphism ? How to achieve low cost and high stability for cloud native applications ?elementui Shuttle box el-transfer Display list content text too long C/C++ Memory model Element-Ui assembly Message Message prompt , alert Popup C# Making a simplified version of calculator Python In pycharm editor Interface style modification Tiktok refresh progress bar ( Two little balls turn ), The code is simple