You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
851 B
32 lines
851 B
package com.platform.test;
|
|
|
|
import java.util.Calendar;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import org.junit.Test;
|
|
|
|
import com.platform.utils.DateForm;
|
|
|
|
public class calendarTest {
|
|
|
|
@Test
|
|
public void testOne() {
|
|
Calendar c2 = Calendar.getInstance();
|
|
System.out.println(DateForm.date2StringBysecond(c2.getTime()));
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
map .put("endTime", DateForm.date2StringBysecond(c2.getTime()));
|
|
// 时间设置为 半年前的时间
|
|
c2.set(Calendar.DAY_OF_YEAR, c2.get(Calendar.DAY_OF_YEAR) -10);
|
|
String time = DateForm.date2StringBysecond(c2.getTime());
|
|
System.out.println(time);
|
|
|
|
// 时间设置为 10天 前的时间
|
|
map.put("startTime", time);
|
|
for ( String key : map.keySet()) {
|
|
System.err.println(key+" "+map.get(key));
|
|
}
|
|
}
|
|
|
|
}
|