• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calculate with dates

 
bs vest
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to have 2 dates on a midlet but it seems that it das not work.
the java code that I want to translate to a Midlet is this.
GregorianCalendar day = new GregorianCalendar();
GregorianCalendar back = new GregorianCalendar();
back.add(Calendar.DATE, -35);
Date d = day.getTime();
Date e = back.getTime();
DateFormat A = DateFormat.getDateInstance(DateFormat.LONG);
DateFormat C = DateFormat.getDateInstance(DateFormat.LONG);
String B = A.format(d);
String T = C.format(e);
whats wrong.
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Move to General Computing or Java - Intermediate
 
bs vest
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
private Date today,yday;
private Calendar cal;
{
today = new Date(System.currentTimeMillis());
cal = Calendar.getInstance();
yday = cal.getTime();
long time = yday.getTime();
long time2 = 35 * 86400000;
long time3 = today.getTime();
time = time3 - time2;
yday = new Date(time);
}
whats wrong in this code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic