Java easy to forget some of the methods of collection

Source: Internet
Author: User

1, long time=system.currenttimemills (); Get current system time

2. Date formatting and conversions to and from the self-character string

YYYY: Year
MM: Month
DD: Day
HH:1~12-hour System (1-12)
HH:24-hour System (0-23)
MM: Min
SS: Seconds
S: MS
E: Day of the week
D: The day ordinal of a year
F: The first few weeks of January (the total number of days in this month divided by 7)
W: The first few weeks of the year
W: The week of January (will be calculated 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).
Z: Indicates time zone

String timeformat= "yyyy mm month DD Day HH:mm:SS";

SimpleDateFormat sdf=new SimpleDateFormat (TimeFormat);

String Datestring=sdf.format (new Date ());//Date formatting

/**

* Results of Operation June 01, 2018 10:21:001

**/

Date Date=sdf.parse (datestring);//Convert a string to a date type

Java easy to forget some of the methods of collection

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.