Repository navigation
Expand file tree
/
Copy pathTimeTest.java
More file actions
48 lines (44 loc) · 1.57 KB
/
Copy pathTimeTest.java
File metadata and controls
48 lines (44 loc) · 1.57 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package threads_learn;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Properties;
public class TimeTest {
public static void main(String[] args) {
test();
System.out.println(System.currentTimeMillis());
Properties prop = new Properties();
prop.put("11", "12");
System.out.println(prop.containsKey("111"));
System.out.println(prop.containsKey("11"));
Properties oldProp = new Properties();
oldProp.put("a", 1);
Properties newProp = new Properties();
newProp.putAll(oldProp);
oldProp.put("a", 2);
System.out.println("oldProp: " + oldProp);
System.out.println("newProp: " + newProp);
System.out.println(newProp == change(newProp));
System.out.println(newProp);
System.out.println(change(newProp));
}
public static Properties change(Properties oldProp){
Properties newProp = new Properties();
newProp.putAll(oldProp);
return newProp;
}
public static void test(){
SimpleDateFormat myDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try{
date = myDateFormat.parse("2018-11-27 00:00:00");
}catch (ParseException e){
e.printStackTrace();
}
if (date != null){
System.out.println(date.getTime()/1000);
}
//System.out.println(Calendar.getInstance().getTimeInMillis()/1000);
}
}