Date, dateformat, and calendar

Source: Internet
Author: User
Tags dateformat

1. Date class

Common method: Long gettime (): returns the millisecond value since 00:00:00, January 1, January 1, 1970, and converts a date object to a millisecond value.

2. dateformat class

The date format class is an abstract class of the date/time format subclass. format and parse the date and time in a language-independent manner. The date formatting subclass datesimpleformat allows formatting (date-> text) and parsing (text-> date ).

Common method of dateformat class:

    • String string format (date): format a date object as a date/time string
    • Date parse (string STR Str): parses a specified string to ask a date/time object.

 

3. Calendar class

Common methods in the calendar class:

    • Abstract void add (INT field, int amount): add or subtract the specified time amount for the specified calendar field according to calendar rules.
    • Int get (INT field): returns the value of the given calendar field.
    • Static calendar getinstance (): obtains a calendar using the default time zone and language environment.
    • Date gettime (): returns a date object that represents the time value of this calendar.
    • Void set (INT field, int value): sets the specified calendar field to the specified value.

Date, dateformat, and calendar

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.