-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
28 lines (24 loc) · 957 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.*;
public class Main {
public static void main(String[] args) {
String strDate, strTime = "";
Date objDate = new Date();
System.out.println("今天的日期是:" + objDate);
long time = objDate.getTime();
System.out.println("自1970年1月1日起以毫秒为单位的时间(GMT):" + time);
strDate = objDate.toString();
//提取 GMT 时间
strTime = strDate.substring(11,(strDate.length() - 4));
//按小时、分钟和秒提取时间
strTime = "时间:" + strTime.substring(0,8);
System.out.println(strTime);
List<Integer> list = new ArrayList<Integer>(Arrays.asList(1,2,3,4,5));
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run(){
System.out.println("11");
}
}, 1000, 2000);
}
}