• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

calculate with dates

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Move to General Computing or Java - Intermediate
 
bs vest
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic