1
如何添加单个时间单位的时间戳,就像Java的“日历”类的“添加方法”,但通过使用黑莓API集 任何人都可以请帮助我与源代码?添加一个单位时间到时间戳用于黑莓应用程序
如何添加单个时间单位的时间戳,就像Java的“日历”类的“添加方法”,但通过使用黑莓API集 任何人都可以请帮助我与源代码?添加一个单位时间到时间戳用于黑莓应用程序
您仍然可以使用黑莓Calendar:
class Scr extends MainScreen {
public Scr() {
Date date = new Date(System.currentTimeMillis());
add(new LabelField("now:"));
add(new LabelField(date.toString()));
add(new LabelField("past month:"));
add(new LabelField(addDateTime(date, Calendar.MONTH, 1).toString()));
}
public Date addDateTime(Date date, int field, int addValue) {
Calendar c = Calendar.getInstance();
c.setTime(date);
int value = c.get(field);
c.set(field, value + addValue);
return c.getTime();
}
}
谢谢最大,它的工作:) – iOSDev 2010-01-19 09:06:10
欢迎你:)! – 2010-01-19 12:26:51