如何确定要在DateField中使用的J2ME中的明天日期? [英] How to determine tomorrow's date in J2ME for use in a DateField?
本文介绍了如何确定要在DateField中使用的J2ME中的明天日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我基本上希望能够显示明天的日期
I basically want to be able to show tomorrows date
我有显示今天的日期的
private Date date = new Date();
我尝试了这个,但这给了我1970年1月1日
i tried this but this gave me jan 1 1970
private Date date = new Date(+1);
请帮助
推荐答案
Date构造函数的整数(实际上很长)参数用于指定自1970年1月1日GMT开始的偏移量的毫秒数。
The integer (actually long) parameter for the Date constructor is for specifying the milliseconds of offset from January 1st, 1970, GMT.
使用日历代替
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 1);
Date date = cal.getTime();
这篇关于如何确定要在DateField中使用的J2ME中的明天日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文