Summary of Java methods for getting time

  • 2020-04-01 02:11:13
  • OfStack

Get the current time,    Format:     Yyyy - mm - dd    Hh - mm - ss
The DateFormat. GetDateTimeInstance (2, 2, Locale. CHINESE). The format (new Java. Util. The Date ());

Getting the current time,    Format:     Yyyy year mm month dd day & noon;   Mm mins ss seconds at am/PM hh
The DateFormat. GetDateTimeInstance (DateFormat. LONG, DateFormat. LONG,     Locale. CHINESE). The format (new Java. Util. The Date ());

Get the current time (to the millisecond),    Format:     Yyyy - mm - dd    Hh: mm: ss.]
The new Java. SQL. Timestamp (System. CurrentTimeMillis ()). The toString ();


Related articles: