Go [Java] Date formatting

Source: Internet
Author: User

ImportOrg.springframework.context.ApplicationContext;ImportOrg.springframework.context.support.ClassPathXmlApplicationContext;ImportJava.text.SimpleDateFormat;ImportJava.util.Calendar; Public classTest2 { Public Static voidMain (string[] args) {ApplicationContext context=NewClasspathxmlapplicationcontext (Newstring[]{"Dispatcher-servlet.xml" }); Calendar Calendar= Context.getbean ("Calendar", Calendar.class); SimpleDateFormat format=NewSimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");    System.out.println (Format.format (Calendar.gettime ())); }}
YYYY: Year  MM:  DD: Day  hh:1~12 Hour System (1-12)  hh:24 Hour (0-23)  mm: Min  ss: sec  S: milliseconds  E:  Days of the week D: The day of the year  F: The first few weeks of January (the number of days total this month divided by 7) W: The Week of the  year  W: The Week of January (according to the actual situation)  A: Last Afternoon logo  K: Similar to HH, indicating a 24-hour day (1-24).  K: Similar to HH, indicating a 12-hour day (0-11).  

Tried, the week used the tail plus E (not lowercase), HH, MM, DD, MM, SS and C # syntax, just C # in the week is dddd, and can use FFFF to format the number of milliseconds, and Java does not support the format of milliseconds.

New SimpleDateFormat ("yyyy-m-d h:m:s E");

Go [Java] Date formatting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.