How to get year, month, day, hours, minutes, seconds and milliseconds of the current moment in Java?

后端 未结 10 1896
渐次进展
渐次进展 2020-11-29 16:58

How can I get the year, month, day, hours, minutes, seconds and milliseconds of the current moment in Java? I would like to have them as Strings.

10条回答
  •  有刺的猬
    2020-11-29 17:16

    Look at the API documentation for the java.util.Calendar class and its derivatives (you may be specifically interested in the GregorianCalendar class).

提交回复
热议问题