Method One:
Use the Date class: DATE.UTC (int year,int month, int date,int hrs, int min,int sec);
Long ms = DATE.UTC (2009, 0, 1, 0, 0, 0);//Time: From January 1, 1970 0:0 0 seconds, to
January 1, 2009, 0:0 the number of milliseconds in 0 seconds.
Note: the DATE.UTC () function is deprecated and is not advocated for use.
Method Two:
Use the Calendar class:
Function ditto
Calendar C = calendar.getinstance ();
C.set (calendar.year,2009);
C.set (calendar.month,0);
C.set (calendar.date,1);
C.set (calendar.hour_of_day,0);
C.set (calendar.minute,0);
C.set (calendar.second,0);
Long ms = C.gettimeinmillis ();
The method of obtaining time by the number of milliseconds starting at a specific time: code continues above the
Long mstime = 91816645*1000;
Long UTC = ms + Mstime;
C.settimeinmillis (UTC);
Date d = c.gettime ();
SimpleDateFormat SF = new SimpleDateFormat ("Yyyy_mm_dd HH:mm:ss");
String time = Sf.format (d);