It is mainly used for Date objects. First, let's recall the parameters and methods of the Date object. The Code is as follows. If you are interested, refer
Knowledge point:
It is mainly used for Date objects. (The following content is from the
Detailed explanation of java time and date usage and query code, and detailed explanation of java date code
As long as the format is correct, you can directly compare the string, and the accuracy is the same as that of seconds.
String s1 = "2003-1
Some date-related functions that may be used during development are extracted as tool classes for your reference:
/*** Date operation tool class. ** @ author shimiso */public class DateUtil {private static final String FORMAT = "yyyy-MM-dd HH: mm:
This article describes the date-related operations in the Java development process, sharing the following code:
Package JSE;
Import java.io.UnsupportedEncodingException;
Import java.text.ParseException;
Import
Java processing Date Time common methods:
1. Java.util.Calendar
The Calendar class is an abstract class that provides methods for a specific moment to transform between a set of calendar fields such as year, MONTH, Day_of_month, HOUR, and for
Found in the course of use,
public static void Main (String args[]) {
Date date = new Date ();
System.out.println (Date.getyear ();
}
The output is: 114 and the GetYear () method is no longer recommended.
So I thought of the calendar.
The
Date D=new date ();SimpleDateFormat df=new SimpleDateFormat ("Yyyy-mm-dd");System.out.println ("Today's Date:" +df.format (d));System.out.println ("Two days ago Date:" + Df.format (new Date (D.gettime ()-(LONG) 2 * 24 * 60 * 60 *
In the Java development of logistics or other functions will be used to two date different days of data, so tidy up a spare.Call Mode:
Copy Code code as follows:
Long date1 = GetDateTime ("20121201")//can be changed to its own date
Java Processing Date Time common methods: 1.java.util.calendar The Calendar class is an abstract class that provides methods for converting between specific moments and a set of calendar fields such as year, MONTH, Day_of_month, HOUR, and
Recently in the boring reading, encountered a programming topic, the problem is described as follows: Black Friday originated from Western superstition: Jesus Christ died in Friday, and 13 is an unlucky number. Black Friday that day is also the
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.