在Android应用中,插入日历事件时,如何为插入日历事件设置时区。任何帮助都非常感谢,并提前感谢...
答案 0 :(得分:2)
您可以创建一个日历实例。
public static Date getDate(Date date,TimeZone zone){
Calendar cal= Calendar.getInstance(zone);
cal.setTimeInMillis(date.getTime());
Calendar output = Calendar.getInstance();
output.set(Calendar.DAY_OF_MONTH, first.get(Calendar.DAY_OF_MONTH));
output.set(Calendar.MONTH, first.get(Calendar.MONTH));
output.set(Calendar.YEAR, first.get(Calendar.YEAR));
output.set(Calendar.HOUR_OF_DAY, first.get(Calendar.HOUR_OF_DAY));
output.set(Calendar.MINUTE, first.get(Calendar.MINUTE));
output.set(Calendar.SECOND, first.get(Calendar.SECOND));
output.set(Calendar.MILLISECOND, first.get(Calendar.MILLISECOND));
return output.getTime();
}