Learn about simpledateformat example milliseconds, we have the largest and most updated simpledateformat example milliseconds information on alibabacloud.com
DateFormat1. DateFormat IntroductionThe role of DateFormat is to format and parse the date/time. In fact, it is the date formatting tool that helps us format date and then converts date into the string string we want to useHowever, the DateFormat
Learning GoalsMastering the use of the date classyou can use the Calendar class to get a full dateMastering Date-formatted operationsformat conversion operation for dates that can be used with SimpleDateFormatto write a date-Acquired action
SimpleDateFormat is a specific class that formats and parses dates in a language-related way. It allows formatting (date-and text), parsing (text-to-date), and normalization.SimpleDateFormat allows you to select any user-defined pattern of date-time
First look at all the representations of the formatted log.[Plain]View plain copy
Time Date Identifier:
YYYY: Year
MM: Month
DD: Day
HH:1~12-hour System (1-12)
[Plain]View plain copy
HH:24-hour System (0-23)
Java. util. Date: indicates a specific moment, accurate to milliseconds. Before jdk1.1, the date is interpreted as the year, month, day, hour, minute, and second values, but its functions are not easy to internationalize. Therefore, from jdk1.1, use
Before a blog is to use NSDateFormatter to format the output of time, but the use of a bit cumbersome, today introduced under the recently used SimpleDateFormat.1 Public class extends DateFormatDate and Time modeDate and time formats are specified
Java gets the current system time, accurate to several milliseconds, java milliseconds
Import java. text. SimpleDateFormat; import java. util. Date; import java. util. Calendar; public class MainProcess {public static void main (String [] args ){//
24-hour time display:
public class Datetime { public static void main(String args[]){ java.util.Date current=new java.util.Date(); java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
JAVA gets the timestamp of the current month's initial time
public static long Getmonthfirstday () {
Calendar calendar = calendar.getinstance ();//Get current date
Calendar.add (calendar.month, 0);
Calendar.set (Calendar.day_of_month, 1);/
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.