日期:2014-05-20 浏览次数:20663 次
October 29, 2012, 3:00:00 PM
Date date=new Date();
DateFormat df=new SimpleDateFormat("MMM dd, yyyy, h:mm:ss a",Locale.ENGLISH);
System.out.println(df.format(date));
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);//每天
calendar.set(year, month, day, 1, 30, 00);
Date date = calendar.getTime();
System.out.println(date);
public static final String FORMAT = "MMMM dd,yyyy hh:mm:ss a";
public static String dateToString(Date date, String format) {
String result = "";
SimpleDateFormat formater = new SimpleDateFormat(format,Locale.ENGLISH);
try {
result = formater.format(date);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public static String getNow() {
Calendar today = Calendar.getInstance();
return dateToString(today.getTime(), FORMAT);
}
Map<String, String> m=new HashMap<String, String>();
m.put("Jan", "January");