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