Java class Date class overview and methods

Source: Internet
Author: User

1.Date class overview

Class date represents a specific moment, accurate to milliseconds


2. Construction method

Public Date ()

Public date (long date)


3. Member Methods

Public long GetTime ()

public void SetTime (long time)

Package com;import java.util.date;/** * date class overview The  * date class represents a specific moment, accurate to milliseconds  *   *  construction Method  * public date ()  *  public date (long date)  *   *  member Method  * public long gettime ()  *  public  void settime (long time)  * */public class datedemo {public static  void main (String[] args)  {//public date () date date = new date (); SYSTEM.OUT.PRINTLN (date);//wed oct 12 19:20:56 cst 2016//public date (long  Date) Long currenttime = system.currenttimemillis ();D ate date2 = new date ( CurrentTime); System.out.println (Date2);//wed oct 12 19:21:41 cst 2016//public long  GetTime () long time = date.gettime (); System.out.println (time);//1476271328357//public void settime (LONG&NBSp;time) Date.settime (System.currenttimemillis ()); SYSTEM.OUT.PRINTLN (date);//wed oct 12 19:22:57 cst 2016}}


This article is from the "11831428" blog, please be sure to keep this source http://11841428.blog.51cto.com/11831428/1861234

Java class Date class overview and methods

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.